I’m in the process of trying to take my post processing to the next level by deferring the comskip and transcoding steps to a later time. This is to alleviate the server load during prime watching hours and let my household watch a TV show that has just finished recording without having to wait another 30-60min for the post process to complete.
I had the idea of my post process script simply add the item to a message queue (python-rq.org) so it finishes the post process immediately and then a worker could do what I want at a time that is appropriate. The first issue I’ve run into pretty quickly is the path passed into the script is of course the temp .grab directory like…
/data/TV Shows/.grab/aa7001b606692bd67acbf97bacc4046311674b6c/The Amazing World of Gumball (2011) - S05E17 - The Box.ts
Naturally the show is no longer in that .grab directory by the time a worker needs to process it, so does anyone know if there is a way to infer the final path of the file after the post process script runs? I didn’t see anything in the API and webhooks don’t fire when media is added (after the recording). I probably could figure out where the resulting file is by searching the episode file name in the API or a brute force file system search, but I’d like to avoid “best guesses” if possiable.
Unless you actually have .ts files in your library that you don’t want to transcode, why not have the transcoding and comskip script look for any .ts files that are not in .grab folders in your media library and perform the work on them? I’m actually working on setting up a different instance that does the post processing but am running into issues with having the post processing script that plex calls ssh to the other instance and run the transcoding and comskip script. I’m considering doing what I suggested and just have the script work on finished .ts recordings at set times using cron.
Edit: Just saw you’re running Dockerized. In any case, I use an inotifywait script to accomplish this (and I exclude the .grab directory so that nothing is processed until it’s copied to my library). This allows me to post-process recordings in place and would easily allow me to delay/queue post-processing tasks if desired. I process files as they come in, but this mechanism allows me to obtain the full destination path and process the incoming files in their destination folders.