NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Add-ons (3rd party plugins, utilities and skins) v
« Previous 1 2 3 4 5 6 … 20 Next »
Help with batch file

 
  • 0 Vote(s) - 0 Average
Help with batch file
CDinger
Offline

Member

Posts: 151
Threads: 30
Joined: Aug 2016
#1
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

Confusedkip:
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
ElihuRozen
Offline

Senior Member

Massachusetts, USA
Posts: 514
Threads: 51
Joined: Apr 2006
#2
2017-12-05, 10:58 PM
If you look at the output from your logfile, you'll see that the Title already has double quotes. When you have 'if "%5" == ', that gets treated as 'if ""The View"" == '. You could probably just remove the double quotes from around the %5.
Tuners: SD HDHR Prime (HDHR3-CC). SD HDHR Connect Quatro Tuner (HDHR5-4US) - only QAM.  EXVIST H.265 Encoder - capturing cable box.
Client: Odroid-N2 running knewc on KODI - connected via MoCA.
EPG: SchedulesDirect
Provider: Verizon Fios
Server: Dell XPS 8700 with Windows 10
JavaWiz
Offline

Posting Freak

Jacksonville, FL. USA
Posts: 2,522
Threads: 141
Joined: Dec 2006
#3
2017-12-06, 12:37 AM
Made a few updates to your version for simplification, I've lightly tested this but not sure that it's 100%

Code:
@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"
    Call :LOGMSG Channel skip check...
    if "%CH_NUM%" == "6.1" GoTo :CHANNEL_SKIP
    if "%CH_NUM%" == "6.2" GoTo :CHANNEL_SKIP
    if "%CH_NUM%" == "6.3" GoTo :CHANNEL_SKIP

    Call :LOGMSG Football check...
    if %REC_TITLE% == "Football"           GoTo :FOOTBALL
    if %REC_TITLE% == "College Football"   GoTo :FOOTBALL

    Call :LOGMSG Specific channel check...
    if "%CH_NUM%" == "3.1"  GoTo :CHANNEL_SPECIFIC
    if "%CH_NUM%" == "10.1" GoTo :CHANNEL_SPECIFIC
    if "%CH_NUM%" == "13.1" GoTo :CHANNEL_SPECIFIC
    if "%CH_NUM%" == "40.1" GoTo :CHANNEL_SPECIFIC

:DEFAULT
    Call :LOGMSG Default Comskip selected...
    Call :COMSKIP
    GoTo :EXITJOB
    
:CHANNEL_SKIP
    Call :LOGMSG - skipping comskip on %FILENAME%; channel %CH_NUM% because it is in skip list
    GoTo :EXITJOB

:CHANNEL_SPECIFIC
    Call :COMSKIP CHANNEL_%CH_NUM%.ini
    GoTo :EXITJOB

:FOOTBALL
    Call :COMSKIP Football.ini
    GoTo :EXITJOB

--------------------------------------------------------------
:COMSKIP
    if %1.==. (
        Set iniFile=
    ) else (
        Set iniFile=--ini=%1
    )
    Call :LOGMSG - invoking comskip on %FILENAME%  %iniFile%
    comskip %FILENAME% %iniFile%
    Call :LOGMSG - comskip finished with %FILENAME%
    GoTO :EOF

--------------------------------------------------------------
:LOGMSG
    echo %*
    echo %date:~4% %time% %* >> %LOGFILE%
    rem echo %date:~4% %time% [%SCRIPTNAME%] %* >> %LOGFILE%
    GoTo :EOF

--------------------------------------------------------------
:EXITJOB
Exit /b
CDinger
Offline

Member

Posts: 151
Threads: 30
Joined: Aug 2016
#4
2017-12-06, 04:31 AM
I believe you are onto something. I removed the double quotes and it appears to be working though I won't know for sure until I record a football game.

JavaWiz went above and beyond and rewrote a custom batch file.
CDinger
Offline

Member

Posts: 151
Threads: 30
Joined: Aug 2016
#5
2017-12-06, 04:34 AM (This post was last modified: 2017-12-06, 05:06 AM by CDinger.)
JavaWiz,

Wow, I sort of understand your upgrade. Pretty impressive. I spent way more time over the past 2 days accomplishing next to nothing and you rewrote the code in no time. Best I stick to my day job.

Just recorded a PBS channel thus no comskip and a regular channel. Both processed appropriately with log entries.

I really appreciate your help.

Thanks,

Craig
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  IRSS and channel-changing batch files Len_Lekx 5 3,503 2018-07-18, 08:12 PM
Last Post: Len_Lekx
  UpdateEPG Batch File for Using GuidePlus GWCowling323 1 3,108 2016-10-07, 10:49 AM
Last Post: Graham
  Imagegrablite - reverse rename batch file help jam_zhou 1 1,845 2015-03-27, 10:12 PM
Last Post: mvallevand
  Files Plugin crashes when there is an ' in the file name. cbgifford 89 27,948 2015-01-28, 05:19 AM
Last Post: mvallevand
  ImageGrabLite Failing to Download Updated Episode File from thetvdb pkscout 4 3,179 2015-01-20, 01:09 PM
Last Post: mvallevand
  NPVR to XBMC File Renaming Utility craigrs84 6 4,705 2014-10-03, 02:59 PM
Last Post: tron999
  what comskip file does npvr use? jam_zhou 1 1,884 2014-08-19, 06:15 PM
Last Post: mulletback
  Imagegrablite - get it to (re)run on all oid's in database as a batch? jksmurf 12 5,913 2014-06-05, 09:06 PM
Last Post: mvallevand
  What's that video file time reindexing utility again? baj1 3 3,416 2012-09-30, 08:53 PM
Last Post: baj1
  Recordings database to NFO file??? psycik 0 1,948 2012-03-23, 05:02 AM
Last Post: psycik

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode