2013-10-15, 04:01 AM
Targeted copy of a specific file from default naming format to Series-Episode.ext using Windows SendTo.
I set this up using Windows 8 x64, your mileage may vary. Specifically you probably have at least change the path name to NScriptHelper.exe. The path on my system is C:\Program Files (x86)\NPVR\NScriptHelper.exe, yours may be different.
As an alternative to doing mass renames/copies, or to doing a rename/copy triggered by PostProcessing.bat, I set up an easy way to rename/copy a specific file with a simple right click.
1) Place this script that I called CopyToSeriesEpisode.bat in a directory. I placed it in C:\Users\Public\NPVR\Scripts so that it could be used by other NPVR scripts, but for these purposes it could go anywhere.
2) Navigate to that directory, right click on this batch file and select "Create Shortcut". This will create a shortcut file called "CopyToSeriesEpisode - Shortcut".
3) Rename this shortcut file to whatever is meaningful to you. I renamed it to "CopyToSeriesEpisode NPVR script".
4) Find your Windows SendTo folder and move the shortcut to that folder. On my system it is C:\Users\((your user name))\AppData\Roaming\Microsoft\Windows\SendTo .
5) Now navigate to your NPVR recording directories and right click a recorded file. Select Send To and then CopyToSeriesEpisode NPVR script. The file is copied to the same directory as the source.
I use mc2xml for my EPG and it apparently includes subtitle information. I suppose it is possible your EPG does not include subtitle info depending upon the source. But you should be able to modify this to suit your needs.
Thanks to johnsonx42 and others for their example scripts using NScriptHelper.
As a follow-up question, is there an up to date doc on NScriptHelper somewhere? I saw a post a few days ago where sub intimated that another option was going to be added, I think it was date related. I'm wondering what other options exist for NScriptHelper.
I set this up using Windows 8 x64, your mileage may vary. Specifically you probably have at least change the path name to NScriptHelper.exe. The path on my system is C:\Program Files (x86)\NPVR\NScriptHelper.exe, yours may be different.
As an alternative to doing mass renames/copies, or to doing a rename/copy triggered by PostProcessing.bat, I set up an easy way to rename/copy a specific file with a simple right click.
1) Place this script that I called CopyToSeriesEpisode.bat in a directory. I placed it in C:\Users\Public\NPVR\Scripts so that it could be used by other NPVR scripts, but for these purposes it could go anywhere.
Code:
@echo off
set subtitle=
set title=
set filepath=%~dp1
set fileext=%~x1
set source=%~f1
set sourcefn=%~n1
set sourcepath=%filepath%
set destpath=%filepath%
FOR /F "tokens=*" %%i in ('C:\"Program Files (x86)"\NPVR\NScriptHelper.exe -title "%source%"') do SET title=%%i
FOR /F "tokens=*" %%i in ('C:\"Program Files (x86)"\NPVR\NScriptHelper.exe -subtitle "%source%"') do SET subtitle=%%i
set title=%title:?=-%
set title=%title:/=-%
set title=%title:\=-%
set title=%title::=-%
set title=%title:&=-%
set subtitle=%subtitle:?=-%
set subtitle=%subtitle:/=-%
set subtitle=%subtitle:\=-%
set subtitle=%subtitle::=-%
set subtitle=%subtitle:&=-%
set destfn=%title%-%subtitle%%fileext%
set dest=%filepath%%destfn%
echo -----------------------------------------------
echo source path is %sourcepath%
echo source file is %sourcefn%
echo fileext is %fileext%
echo series is %title%
echo episode is %subtitle%
echo dest path is %destpath%
echo dest file is %destfn%
echo -----------------------------------------------
echo.
echo copying %sourcefn% to %destfn%
copy "%source%" "%dest%"
2) Navigate to that directory, right click on this batch file and select "Create Shortcut". This will create a shortcut file called "CopyToSeriesEpisode - Shortcut".
3) Rename this shortcut file to whatever is meaningful to you. I renamed it to "CopyToSeriesEpisode NPVR script".
4) Find your Windows SendTo folder and move the shortcut to that folder. On my system it is C:\Users\((your user name))\AppData\Roaming\Microsoft\Windows\SendTo .
5) Now navigate to your NPVR recording directories and right click a recorded file. Select Send To and then CopyToSeriesEpisode NPVR script. The file is copied to the same directory as the source.
I use mc2xml for my EPG and it apparently includes subtitle information. I suppose it is possible your EPG does not include subtitle info depending upon the source. But you should be able to modify this to suit your needs.
Thanks to johnsonx42 and others for their example scripts using NScriptHelper.
As a follow-up question, is there an up to date doc on NScriptHelper somewhere? I saw a post a few days ago where sub intimated that another option was going to be added, I think it was date related. I'm wondering what other options exist for NScriptHelper.