2015-10-03, 05:28 PM
I'm trying to get a script running that checks if a recording is in progress before updating the EPG. My updates are scheduled to run at 5am, not a time I normally have recordings going, but ever once in a while it presents a problem. I messed around with this a while back but couldn't get it working. Having lost another recording has motivated me to fix it. I good while ago I found a snippet that is supposed to check if a recording is in progress and wait until it's done before starting the EPG update. Unfortunately running the bat file seems to put the script into a loop and never actually does anything. I added some simple logging to the script so I could see were the problem occurs. There's nothing recording but the script just keeps restarting itself. Could someone script savvy take a look and see if there's any glaring errors that might be causing
And here's a portion of the log that gets generated.
Snag
Code:
@ECHO off
REM Update EPG only if not recording
ECHO -------------------------- >> epg.log
ECHO Starting new updateEPG BAT file run - %time%>> epg.log
CD /d "%~dp0"
:loop
set chknpvr=1
"c:\Program Files (x86)\NPVR\NScriptHelper.exe" -isInUse | find "NOT RECORDING"
set chknpvr=%ERRORLEVEL%
if %chknpvr% NEQ 0 timeout 300
if %chknpvr% NEQ 0 goto loop
if %chknpvr% EQU 0 "C:\Program Files (x86)\NPVR\NextPVR.exe" -updateepgonly
ECHO updateEPG BAT complete - %time%>> epg.log
exit
And here's a portion of the log that gets generated.
Code:
Starting new updateEPG BAT file run - 13:07:56.88
--------------------------
Starting new updateEPG BAT file run - 13:07:58.18
--------------------------
Starting new updateEPG BAT file run - 13:07:59.50
--------------------------
Starting new updateEPG BAT file run - 13:08:00.80
--------------------------
Starting new updateEPG BAT file run - 13:08:02.09
--------------------------
Starting new updateEPG BAT file run - 13:08:03.43
--------------------------
Starting new updateEPG BAT file run - 13:08:04.73
--------------------------
Starting new updateEPG BAT file run - 13:08:06.01
--------------------------
Starting new updateEPG BAT file run - 13:08:07.30
--------------------------
Starting new updateEPG BAT file run - 13:08:08.58
--------------------------
Starting new updateEPG BAT file run - 13:08:09.89
--------------------------
Starting new updateEPG BAT file run - 13:08:11.23
--------------------------
Starting new updateEPG BAT file run - 13:08:12.52
Snag
NextPVR V6.1.5.231022 - Ubuntu 22.04 VM / 4 core / 8Gb memory
HDHR Prime X2 / HDFX-2 /Schedule Direct / 2X Pi4 + & 3X Pi3 LibreELEC Kodi clients
Server - TrueNAS/ SuperMicro MBD-X10SL7-F MB / Xeon E3-1246 / 32Gb Unbuffered ECC / 8 X 4TB RAIDZ2
HDHR Prime X2 / HDFX-2 /Schedule Direct / 2X Pi4 + & 3X Pi3 LibreELEC Kodi clients
Server - TrueNAS/ SuperMicro MBD-X10SL7-F MB / Xeon E3-1246 / 32Gb Unbuffered ECC / 8 X 4TB RAIDZ2