I think this coincided with upgrading my PMS to the first version of 1.24, but I’ve noticed for the last several recorded shows that my post processing script is not being called. It is properly located in the C:\Users\myUser\AppData\Local\Plex Media Server\Scripts folder, though it does call executables located elsewhere (always has, with no issues). One of the calls writes the path of the show being processed to a log file, which doesn’t occur anymore. Has anyone else noticed this? I just turned debug logging back on today, so hopefully I might get some more information the next recording.
I turned on debug logging and got some more information, but it does not help at all:
Aug 09, 2021 22:11:00.047 [5680] DEBUG - [Grabber/0353e60dcb2b302a27da60ceaba02ce92088bee8/JobRunner] Job running: "C:\Users\HTPC\AppData\Local\Plex Media Server\Scripts\PostProcessDVR.bat" "W:\PlexDVR\.grab\0353e60dcb2b302a27da60ceaba02ce92088bee8-e346d4ab2125bcc7ac7aa7ee664f2d3a64885060\The Bachelorette (2003) - S17E10 - The Bachelorette.ts"
Aug 09, 2021 22:11:00.078 [5680] DEBUG - [Grabber/0353e60dcb2b302a27da60ceaba02ce92088bee8/JobRunner] Jobs: Starting child process with pid 1764
Aug 09, 2021 22:11:00.109 [3428] DEBUG - Jobs: 'C:\Users\HTPC\AppData\Local\Plex Media Server\Scripts\PostProcessDVR.bat' exit code for process 1764 is 1 (failure)
Aug 09, 2021 22:11:00.109 [5680] ERROR - [Grabber/0353e60dcb2b302a27da60ceaba02ce92088bee8] Recorder: Postprocessing script 'C:\Users\HTPC\AppData\Local\Plex Media Server\Scripts\PostProcessDVR.bat' exited with error code 1.
I now see that the script is, in fact, being called (so I’ve edited the post title to reflect this). But it exits immediately with an error code of 1. Here is the contents of the .bat file that is run:
@echo off
C:\Resources\HtpcLog.exe source="PostProcessDVR" level="info" message=%1
C:\Resources\TvRecordingMover.exe %1
Both HtpcLog.exe and TvRecordingMover.exe are C# .NET console apps that I wrote; and neither set a process return value. Both should also write at least something to a log file on all paths of execution, but nothing shows up. Also, when I copy/paste the command line Plex reports that it is calling for the script into a CMD window, everything works as expected. So something about the way Plex is executing the post processing script has changed and is now broken, but the logs don’t help me figure out what. Any ideas?
I guess %1 is the path to file, right?
What if that path has spaces, isn’t that a problem for your program? On Linux I would put that variable between double quotes ("$1"), but I don’t know if that works the same on Windows
Yes, %1 is the full path to the recorded file. It’s not an issue of the script itself. The script hasn’t changed in at least a couple of years (maybe longer), as has properly handled filenames with spaces. I would see errors in my app-specific log file if the file path came in weird. Even worked not too long ago with the exact same show as it failed on above. Something changed in Plex with regard to the post-processing script (my guess is with the bump to 1.24), but I don’t see anything in changelogs or the debug output to help me identify it. Maybe I’ll have to turn on verbose logging for the show I’m recording tonight and see if that gives me any more clues.
Considered it, but really would rather not given the
“NOTE : After installing this version if you decide to downgrade to a release prior to 1.24.0 it will require a media analysis to be run on all existing video items.”
from the release notes. Doesn’t sound like a confidently clean downgrade. Plus, I’m hoping all it takes is a Plex dev to try a post-processing script and go “yup, it’s broke, we didn’t notice that, let’s figure out why”.
So I have no idea if it worked or not because the three recordings I had for tonight never ended. Over an hour an a half past end time, and Plex still says they’re all still recording.
UPDATE: It looks like the script execution hung now. Had to kill off Plex and the scripts. I’ll have to retry with the next round of recordings. And debug logging on.