Results 1 to 2 of 2

Thread: NScriptHelper.exe command to return # of active recordings

  1. #1
    Join Date
    Jun 2007
    Location
    St. Paul, MN, USA
    Posts
    1,016

    NScriptHelper.exe command to return # of active recordings

    Would you consider adding an option for NScriptHelper.exe that would return the number of currently active recordings?

    With pre- and post-padding overlap (primarily on hour show changeover times), I'm semi-frequently seeing 6+ recordings going on simultaneously. When you add in 1 playback stream and 1 or 2 comskip batches, it seems that the main recording drive is sometimes being overwhelmed. I already throttle the comskip processing to limit it to 2 concurrent processes all the time. But I was thinking that possibly limiting it to 1 (or 0) when the number of active recordings is above a certain count might help. Making that change to my script would be fairly easy if NScripthelper.exe could return the current active recording count.

  2. #2
    Join Date
    Mar 2006
    Location
    Houston, Texas, USA
    Posts
    725
    I have recently noticed a problem in my PostProcessing.bat script that occasionally lets too many instances of comskip run. It causes any video being watched at the same time to stutter badly. It isn't the fault of NPVR, but of the PostProcessing.bat script that I have running. Could this be happening to your system as well?

    Here's a script that I borrowed from this forum a few years back. IIRC, johnsonx42 wrote it. I modded it to invoke only a single instance of comskip at a time because comskip is horribly slow on Comcast's new mpeg4 videos if I enable "play nice" in comskip.ini, even with the paid version. However, I'm seeing that when shows end at the same time, with channel numbers that are close to each other, then more than one instance of comskip that be started by the script before the script checks again to see if comskip is already running. When multiple instances of comskip are running full speed ahead they can overwhelm the disk subsystem.

    Here's the script I'm using, followed by a snippet of the log file that shows where the channel numbers (used to define the pause duration) are close enough to each other that they finish their pause within the same 1-minute wait window and the script kicks off 2 at once.

    Code:
    echo %date%,%time% - PostProcessing.bat invoked on %1 recorded from channel %2 >>PostProcessing.log
    
    Rem list of channels to not run comskip on; PBS channels have no commercials
    if "%2" == "608" goto skip
    Rem if "%2" == "28" goto skip
    
    goto next
    
    :skip
    echo skipping comskip on %1; channel %2 because it is in skip list >>PostProcessing.log
    goto continue
    
    :next
    rem need to add a pause to avoid race conditions
    echo   ---  sleeping %2 seconds to avoid simultaneous execution >>PostProcessing.log
    sleep %2
    
    rem check how many comskips are running; if 1 or more are running wait 1 minute and check again
    rem the third parameter passed in npvr 1.5.36 and later is a unique recording oid number, so it makes a good filename to store the temporary count
    :check
    tasklist | find /c "comskip" > %3.txt
    set /p count= <%3.txt
    if %count% geq 1 (
      echo ...%count% comskips running now, waiting 1 minute >>PostProcessing.log
      timeout 60
      goto check
    )
    del %3.txt
    
    rem continuing now 
    
    Rem this trick also makes it possible to have dedicated comskip.ini file for certain channels.
    rem if "%2" == "79" goto channel79
    Rem use the default comskip.ini for all other channels
    rem goto generic
    
    rem :channel79
    rem comskip --ini=channel79.ini %1
    rem goto continue
    
    :generic
    echo %date%,%time% - invoking comskip on %1 >>PostProcessing.log
    comskip %1
    echo %date%,%time% - comskip finished with %1 >>PostProcessing.log
    
    :continue
    
    :eof
    Log file with timing problem underlined:

    Code:
    Fri 02/24/2017,20:03:00.59 - PostProcessing.bat invoked on "F:\GB-PVR Video\The Vampire Diaries\The.Vampire.Diaries.S08E14.Its.Been.a.Hell.of.a.Ride.ts" recorded from channel 605 
      [B]---  sleeping 605 seconds to avoid simultaneous execution [/B]
    Fri 02/24/2017,20:03:00.60 - PostProcessing.bat invoked on "F:\GB-PVR Video\MacGyver\MacGyver.S01E17.Ruler.ts" recorded from channel 611 
      ---  sleeping 611 seconds to avoid simultaneous execution 
    Fri 02/24/2017,20:03:01.18 - invoking comskip on "F:\GB-PVR Video\The Vampire Diaries\The.Vampire.Diaries.S08E14.Its.Been.a.Hell.of.a.Ride.ts" 
    Fri 02/24/2017,20:03:01.22 - invoking comskip on "F:\GB-PVR Video\MacGyver\MacGyver.S01E17.Ruler.ts" 
    
    Fri 02/24/2017,20:23:43.35 - comskip finished with "F:\GB-PVR Video\The Vampire Diaries\The.Vampire.Diaries.S08E14.Its.Been.a.Hell.of.a.Ride.ts" 
    Fri 02/24/2017,20:37:54.97 - comskip finished with "F:\GB-PVR Video\MacGyver\MacGyver.S01E17.Ruler.ts" 
    Fri 02/24/2017,[B]21:03:01.06 - PostProcessing.bat invoked on "F:\GB-PVR Video\Sleepy Hollow\Sleepy.Hollow.S04E08.Sick.Burn.ts" recorded from channel 609 
      ---  sleeping 609 seconds to avoid simultaneous execution 
    Fri 02/24/2017,21:03:01.27 - invoking comskip on "F:\GB-PVR Video\Sleepy Hollow\Sleepy.Hollow.S04E08.Sick.Burn.ts" 
    Fri 02/24/2017,21:03:01.91 - PostProcessing.bat invoked on "F:\GB-PVR Video\Hawaii Five-0\Hawaii.Five-0.S07E18.E.Malama.Pono.ts" recorded from channel 611 
      ---  sleeping 611 seconds to avoid simultaneous execution 
    ...1 comskips running now, waiting 1 minute 
    Fri 02/24/2017,21:03:02.79 - PostProcessing.bat invoked on "F:\GB-PVR Video\Reign\Reign.S04E03.Leaps.of.Faith.ts" recorded from channel 605 
      ---  sleeping 605 seconds to avoid simultaneous execution 
    ...1 comskips running now, waiting 1 minute 
    ...1 comskips running now, waiting 1 minute 
    ...1 comskips running now, waiting 1 minute 
    ...1 comskips running now, waiting 1 minute 
    ...1 comskips running now, waiting 1 minute 
    ...1 comskips running now, waiting 1 minute 
    ...1 comskips running now, waiting 1 minute 
    ...1 comskips running now, waiting 1 minute 
    ...1 comskips running now, waiting 1 minute 
    ...1 comskips running now, waiting 1 minute 
    ...1 comskips running now, waiting 1 minute 
    ...1 comskips running now, waiting 1 minute 
    ...1 comskips running now, waiting 1 minute 
    Fri 02/24/2017,21:09:50.06 - comskip finished with "F:\GB-PVR Video\Sleepy Hollow\Sleepy.Hollow.S04E08.Sick.Burn.ts" 
    Fri 02/24/2017,21:10:02.38 - invoking comskip on "F:\GB-PVR Video\Reign\Reign.S04E03.Leaps.of.Faith.ts" 
    Fri 02/24/2017,21:10:02.39 - invoking comskip on "F:\GB-PVR Video\Hawaii Five-0\Hawaii.Five-0.S07E18.E.Malama.Pono.ts" 
    Fri 02/24/2017,21:25:05.17 - comskip finished with "F:\GB-PVR Video\Reign\Reign.S04E03.Leaps.of.Faith.ts" 
    Fri 02/24/2017,21:25:41.53 - comskip finished with "F:\GB-PVR Video\Hawaii Five-0\Hawaii.Five-0.S07E18.E.Malama.Pono.ts"
    Anyone have an idea of how to better manage the pauses so that the system can't start more than the number specified in the script?
    Last edited by HarryH3; 2017-02-27 at 05:44 PM.
    E4600 Core2Duo, 4GB RAM, Win7 Pro, HD5570, HDHomeRun Prime, NPVR 3.6.6, 2 Popcorn Hour A-100's and a partridge in a pear tree...
    On a clear disk, you can seek forever...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •