Team,
Please point me in the right direction if you know of a Plex article/discussion on this topic but I couldn’t find one. Can someone from Plex please provide official details on the list of values Plex provides to DVR post-processing scripts? For example, the name of the video file, the current path to the video file, the target/library path to the video file, etc. Also, how does the script get the values? If they’re passed as script arguments, what’s the full list of arguments and the order in which they’re passed? If on the other hand the script is supposed to pull the values from Plex, how is this done?
Please let me know if you have any questions and thanks in advance.
Regards,
Brad
Hi
I’m not on the Plex team, but Plex calls the script with the full path to the video file as the first value.
This means that you, in a bash script at least, use $1.
You can extract the filename with 'basename “$1” ', and likewise the path by using 'dirname “$1” ’ - which in turn reveals the library path.
The video file itself is recorded into a .grab-directory within the library path you specified when scheduling the recording.
As far as I know Plex doesn’t care about what filename you end up with as long as there is exactly one file present in the output path (the same .grab directory) after the script is done, but I can be completely in the wrong here.
The workflow therefore is as following:
Plex saves recording to .grab directory and calls your script which gets the path and filename via the first argument ($1) and does some magic
The script should then move the resulting output file to the .grab directory and remove the original file
After the script is finished, Plex scans the directory and imports file to chosen library.
Hope this was of some minor help at least.
What type of scrip[t files can be used with this? Like powershell or just batch and shell?
Depends on what OS you are using. There is a bat file posted on Reddit that many are using to run mcebuddy on Windows platforms. There is also a PowerShell script written by another user to run comskip, ffmpeg or Handbrake to cut commercials and convert video to another format. There are also other scripts written by others on the forum for other platforms that also utilize the same tools.
The Plex DVR is on windows and the script is to run bat. I have seen the ones in Reddit and they look fibe just like powershell