Post Processing - Simultaneous TV shows

I’m trying to use the PLEX Post processing script DVR option. I have a script that runs great if there is the only show recorded. - if 2 or more simultaneous TV shows end at the same time, It will only run the script on one of them and leave the rest as .ts files. Here is the .bat file I use.

SETLOCAL
set LOGFILE=D:\Plex\Plex_Post.log
SET FILENAME=%1
call :encode2mkv >> %LOGFILE%
exit /B

:encode2mkv

@ECHO off
@ECHO Starting Batch Run: %date% %time%
@ECHO .
@ECHO .
FOR /F “tokens=*” %%G IN (‘DIR /B /S %FILENAME%’) DO (
@ECHO Using HandBrakeCLI to Convert file “%%G”
ls -l “%%G”
@ECHO .
@ECHO
“C:\Program Files\Handbrake\HandBrakeCLI.exe” -v -i “%%G” -o “%%~dG%%~pG%%~nG.mkv” --preset-import-file “D:\Plex\720p HD Subs.json” -Z “720p HD Subs”
@ECHO .

REM ### Check if converted file exists ###
IF EXIST “%%~dG%%~pG%%~nG.mkv” (
@ECHO Convert Complete for “%%~dG%%~pG%%~nG.mkv”
) ELSE (
ECHO Converted file “%%~dG%%~pG%%~nG.mkv” not found
ECHO “!!! ERROR RAISED !!!”
exit 2
)

dir “%%~dG%%~pG%%~nG.*”
@ECHO Deleting old file “%%G”
del “%%G”
)
@ECHO Batch Run Complete: %date% %time%
@ECHO ##########################################

Any help would be great.

Dc

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.