2017-12-05, 07:23 PM
Below is my batch file. To be clear I modified a batch file from the NPVR wiki created by javawiz. I use it to specify different ini files for different channels. I want to have an ini for football games. I often watch one game live while recording another and it would be great to have the commercials processed when I watch the second game. The channel specific ini are ok but the football specific one does a better more reliable job on detecting show vs commercial. However, when I remove the REM for the football if statement all I get is notification the recording is complete and comskip is NOT run on the file no matter what type of program I record.
I was contemplating using the same approach to having show specific ini but now it seems my approach doesn't work or at least I don't know how to make it work. Also below is the log, I've been recording random shows for testing purposes but the make a change wait 30-60 minutes and see if it works approach isn't going so well so I am asking for help.
Thanks,
Craig
@Echo off
GoTo :BEGIN
=================================================================================================
PostProcessing.bat
Run as soon as a recording ends. Commonly used for adding commercial skipping functionality
(comskip) or transcoding.
-------------------------------------------------------------------------------------------------
Arguments:
1.filename - the full path and file name of the recording file.
2.channelNumber - the channel number it was recorded from.
3.oid - unique identifier to the scheduled_recordings table, applicable even if
filename (%1) changes
4.capture Oid - unique identifier to the device used for recording
5.recording title - the title of the recording
6.comskip ini - the name of the comskip ini file for commercial skip
-------------------------------------------------------------------------------------------------
Modification History
Date By Description
------ ---------- -------------------------------------------------------------------------------
11132017 CD Initial Template
=================================================================================================
:BEGIN
SETLOCAL
Set SCRIPTNAME=%0
Set BASEDIR=c:\Users\Public\NPVR
Set LOGFILE=%BASEDIR%\Logs\PostProcessing.log
Set FILENAME=%1
Set CH_NUM=%2
Set OID=%3
Set DEV_OID=%4
Set REC_TITLE=%5
Call :LOGMSG Recording complete - filename: %FILENAME% ChannelNUM: %CH_NUM% OID: %OID% DeviceOID: %DEV_OID% Title: %REC_TITLE%
cd /d "C:\comskip"
if "%2" == "6.1" goto skip
if "%2" == "6.2" goto skip
if "%2" == "6.3" goto skip
goto next
kip:
echo skipping comskip on %1; channel %2 because it is in skip list >> %LOGFILE%
goto continue
:next
rem if "%5" == "Football" goto Football
rem if "%5" == "College Football" goto Football
if "%2" == "3.1" goto channel_3.1
if "%2" == "10.1" goto channel_10.1
if "%2" == "13.1" goto channel_13.1
if "%2" == "40.1" goto channel_40.1
goto generic
:channel_3.1
echo %date%,%time% - invoking comskip on %1 channel %2 ini >> %LOGFILE%
comskip --ini=channel_3.1.ini %1
echo %date%,%time% - comskip finished with %1 channel %2 ini >> %LOGFILE%
goto continue
:channel_10.1
echo %date%,%time% - invoking comskip on %1 channel %2 ini >> %LOGFILE%
comskip --ini=channel_10.1.ini %1
echo %date%,%time% - comskip finished with %1 channel %2 ini >> %LOGFILE%
goto continue
:channel_13.1
echo %date%,%time% - invoking comskip on %1 channel %2 ini >> %LOGFILE%
comskip --ini=channel_13.1.ini %1
echo %date%,%time% - comskip finished with %1 channel %2 ini >> %LOGFILE%
goto continue
:channel_40.1
echo %date%,%time% - invoking comskip on %1 channel %2 ini >> %LOGFILE%
comskip --ini=channel_40.1.ini %1
echo %date%,%time% - comskip finished with %1 channel %2 ini >> %LOGFILE%
goto continue
:Football
echo %date%,%time% - invoking comskip on %1 channel %2 ini >> %LOGFILE%
comskip --ini=Football.ini %1
echo %date%,%time% - comskip finished with %1 channel %2 ini >> %LOGFILE%
goto continue
:generic
echo %date%,%time% - invoking comskip on %1 >> %LOGFILE%
comskip %1
echo %date%,%time% - comskip finished with %1 >> %LOGFILE%
:continue
:eof
GoTo :EXITJOB
--------------------------------------------------------------
:LOGMSG
echo %*
echo %date:~4% %time% %* >> %LOGFILE%
rem echo %date:~4% %time% [%SCRIPTNAME%] %* >> %LOGFILE%
Goto :EOF
--------------------------------------------------------------
:EXITJOB
Exit /b
Below is the output logfile
12/05/2017 10:00:01.37 Recording complete - filename: "D:\Loving Spoonfuls\Loving.Spoonfuls.S03E08.Yvonne,.JFK.and.the.Rabbit.ts" ChannelNUM: 29.3 OID: 22744 DeviceOID: 20 Title: "Loving Spoonfuls"
Tue 12/05/2017,10:00:01.38 - invoking comskip on "D:\Loving Spoonfuls\Loving.Spoonfuls.S03E08.Yvonne,.JFK.and.the.Rabbit.ts"
Tue 12/05/2017,10:00:56.67 - comskip finished with "D:\Loving Spoonfuls\Loving.Spoonfuls.S03E08.Yvonne,.JFK.and.the.Rabbit.ts"
12/05/2017 10:01:00.48 Recording complete - filename: "D:\ABC 10 News Mornings at 9am\ABC 10 News Mornings at 9am_20171205_09001000.ts" ChannelNUM: 10.1 OID: 22743 DeviceOID: 22 Title: "ABC 10 News Mornings at 9am *"
Tue 12/05/2017,10:01:00.49 - invoking comskip on "D:\ABC 10 News Mornings at 9am\ABC 10 News Mornings at 9am_20171205_09001000.ts" channel 10.1 ini
Tue 12/05/2017,10:06:16.91 - comskip finished with "D:\ABC 10 News Mornings at 9am\ABC 10 News Mornings at 9am_20171205_09001000.ts" channel 10.1 ini
12/05/2017 10:31:00.99 Recording complete - filename: "D:\Global 3000\Global 3000_20171205_10001030.ts" ChannelNUM: 6.3 OID: 22745 DeviceOID: 20 Title: "Global 3000"
skipping comskip on "D:\Global 3000\Global 3000_20171205_10001030.ts"; channel 6.3 because it is in skip list
Below is after removing the rem from the batch file.
12/05/2017 11:01:00.72 Recording complete - filename: "D:\The View\The View_20171205_10001100.ts" ChannelNUM: 10.1 OID: 22746 DeviceOID: 22 Title: "The View"
12/05/2017 11:01:00.78 Recording complete - filename: "D:\Priscillas Yoga Stretches\Priscillas Yoga Stretches_20171205_10451100.ts" ChannelNUM: 6.2 OID: 22747 DeviceOID: 20 Title: "Priscilla's Yoga Stretches"
skipping comskip on "D:\Priscillas Yoga Stretches\Priscillas Yoga Stretches_20171205_10451100.ts"; channel 6.2 because it is in skip list
I was contemplating using the same approach to having show specific ini but now it seems my approach doesn't work or at least I don't know how to make it work. Also below is the log, I've been recording random shows for testing purposes but the make a change wait 30-60 minutes and see if it works approach isn't going so well so I am asking for help.
Thanks,
Craig
@Echo off
GoTo :BEGIN
=================================================================================================
PostProcessing.bat
Run as soon as a recording ends. Commonly used for adding commercial skipping functionality
(comskip) or transcoding.
-------------------------------------------------------------------------------------------------
Arguments:
1.filename - the full path and file name of the recording file.
2.channelNumber - the channel number it was recorded from.
3.oid - unique identifier to the scheduled_recordings table, applicable even if
filename (%1) changes
4.capture Oid - unique identifier to the device used for recording
5.recording title - the title of the recording
6.comskip ini - the name of the comskip ini file for commercial skip
-------------------------------------------------------------------------------------------------
Modification History
Date By Description
------ ---------- -------------------------------------------------------------------------------
11132017 CD Initial Template
=================================================================================================
:BEGIN
SETLOCAL
Set SCRIPTNAME=%0
Set BASEDIR=c:\Users\Public\NPVR
Set LOGFILE=%BASEDIR%\Logs\PostProcessing.log
Set FILENAME=%1
Set CH_NUM=%2
Set OID=%3
Set DEV_OID=%4
Set REC_TITLE=%5
Call :LOGMSG Recording complete - filename: %FILENAME% ChannelNUM: %CH_NUM% OID: %OID% DeviceOID: %DEV_OID% Title: %REC_TITLE%
cd /d "C:\comskip"
if "%2" == "6.1" goto skip
if "%2" == "6.2" goto skip
if "%2" == "6.3" goto skip
goto next
kip:
echo skipping comskip on %1; channel %2 because it is in skip list >> %LOGFILE%
goto continue
:next
rem if "%5" == "Football" goto Football
rem if "%5" == "College Football" goto Football
if "%2" == "3.1" goto channel_3.1
if "%2" == "10.1" goto channel_10.1
if "%2" == "13.1" goto channel_13.1
if "%2" == "40.1" goto channel_40.1
goto generic
:channel_3.1
echo %date%,%time% - invoking comskip on %1 channel %2 ini >> %LOGFILE%
comskip --ini=channel_3.1.ini %1
echo %date%,%time% - comskip finished with %1 channel %2 ini >> %LOGFILE%
goto continue
:channel_10.1
echo %date%,%time% - invoking comskip on %1 channel %2 ini >> %LOGFILE%
comskip --ini=channel_10.1.ini %1
echo %date%,%time% - comskip finished with %1 channel %2 ini >> %LOGFILE%
goto continue
:channel_13.1
echo %date%,%time% - invoking comskip on %1 channel %2 ini >> %LOGFILE%
comskip --ini=channel_13.1.ini %1
echo %date%,%time% - comskip finished with %1 channel %2 ini >> %LOGFILE%
goto continue
:channel_40.1
echo %date%,%time% - invoking comskip on %1 channel %2 ini >> %LOGFILE%
comskip --ini=channel_40.1.ini %1
echo %date%,%time% - comskip finished with %1 channel %2 ini >> %LOGFILE%
goto continue
:Football
echo %date%,%time% - invoking comskip on %1 channel %2 ini >> %LOGFILE%
comskip --ini=Football.ini %1
echo %date%,%time% - comskip finished with %1 channel %2 ini >> %LOGFILE%
goto continue
:generic
echo %date%,%time% - invoking comskip on %1 >> %LOGFILE%
comskip %1
echo %date%,%time% - comskip finished with %1 >> %LOGFILE%
:continue
:eof
GoTo :EXITJOB
--------------------------------------------------------------
:LOGMSG
echo %*
echo %date:~4% %time% %* >> %LOGFILE%
rem echo %date:~4% %time% [%SCRIPTNAME%] %* >> %LOGFILE%
Goto :EOF
--------------------------------------------------------------
:EXITJOB
Exit /b
Below is the output logfile
12/05/2017 10:00:01.37 Recording complete - filename: "D:\Loving Spoonfuls\Loving.Spoonfuls.S03E08.Yvonne,.JFK.and.the.Rabbit.ts" ChannelNUM: 29.3 OID: 22744 DeviceOID: 20 Title: "Loving Spoonfuls"
Tue 12/05/2017,10:00:01.38 - invoking comskip on "D:\Loving Spoonfuls\Loving.Spoonfuls.S03E08.Yvonne,.JFK.and.the.Rabbit.ts"
Tue 12/05/2017,10:00:56.67 - comskip finished with "D:\Loving Spoonfuls\Loving.Spoonfuls.S03E08.Yvonne,.JFK.and.the.Rabbit.ts"
12/05/2017 10:01:00.48 Recording complete - filename: "D:\ABC 10 News Mornings at 9am\ABC 10 News Mornings at 9am_20171205_09001000.ts" ChannelNUM: 10.1 OID: 22743 DeviceOID: 22 Title: "ABC 10 News Mornings at 9am *"
Tue 12/05/2017,10:01:00.49 - invoking comskip on "D:\ABC 10 News Mornings at 9am\ABC 10 News Mornings at 9am_20171205_09001000.ts" channel 10.1 ini
Tue 12/05/2017,10:06:16.91 - comskip finished with "D:\ABC 10 News Mornings at 9am\ABC 10 News Mornings at 9am_20171205_09001000.ts" channel 10.1 ini
12/05/2017 10:31:00.99 Recording complete - filename: "D:\Global 3000\Global 3000_20171205_10001030.ts" ChannelNUM: 6.3 OID: 22745 DeviceOID: 20 Title: "Global 3000"
skipping comskip on "D:\Global 3000\Global 3000_20171205_10001030.ts"; channel 6.3 because it is in skip list
Below is after removing the rem from the batch file.
12/05/2017 11:01:00.72 Recording complete - filename: "D:\The View\The View_20171205_10001100.ts" ChannelNUM: 10.1 OID: 22746 DeviceOID: 22 Title: "The View"
12/05/2017 11:01:00.78 Recording complete - filename: "D:\Priscillas Yoga Stretches\Priscillas Yoga Stretches_20171205_10451100.ts" ChannelNUM: 6.2 OID: 22747 DeviceOID: 20 Title: "Priscilla's Yoga Stretches"
skipping comskip on "D:\Priscillas Yoga Stretches\Priscillas Yoga Stretches_20171205_10451100.ts"; channel 6.2 because it is in skip list