nebhead / PlexPostProc

Plex PostProcessing Script for DVR(Beta)
77 stars 30 forks source link

How to pass it the Plex Filename #10

Closed jeffreyswiggins closed 6 years ago

jeffreyswiggins commented 6 years ago

So I have got the script figured out the point where if i run it manually and put the location and filename of the file after the PlexPostProc.sh it will convert it without issues. If I put the location of the script in my Plex PostProcessing settings for the DVR (including the full Linux path and filename which has been chmod 777) it will error code 1 every time. When I look at the plex log it just seems like the filename is not being passed from plex to the script so how is that supposed to be done? I have googled until my eyes are bleeding for Plex Post Processing switches, parameters, etc and find nothing.

calederer commented 6 years ago

Could you post the log from plex when it tries to execute the script?

calederer commented 6 years ago

Also what is the full command that you use when you execute it manually?

calederer commented 6 years ago

What OS are you using?

jeffreyswiggins commented 6 years ago

uBuntu 16. It and Plex are most recent updates.

/media/plex/PlexPostProc/PlexPostProc.sh is what is in the Plex settings and my shows go in /media/plex/tvshows

I will have to get the plex log when I get back to the server

On May 11, 2018, 15:20 -0500, calederer notifications@github.com, wrote:

What OS are you using? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

calederer commented 6 years ago

I believe you will need to add media/plex/PlexPostProc/ to the PATH ENV variable or you can move the script to one of these locations https://askubuntu.com/questions/386629/what-are-the-default-path-values

jeffreyswiggins commented 6 years ago

OK my question is that in the logs I can see it run the Plex post processing script, however that line contains no plex media file name in it so how does your script get the file name from plex. It seems like I need some parameter like $filename after the script path in the post processing but I can find nothing on formatting that post processing field on a Linux plex server

On May 11, 2018, 15:31 -0500, calederer notifications@github.com, wrote:

I believe will need to add media/plex/PlexPostProc/ to the PATH ENV variable or you can move the script to one of these locations https://askubuntu.com/questions/386629/what-are-the-default-path-values — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

jeffreyswiggins commented 6 years ago

Here are my log example:

May 11, 2018 10:30:48.436 [0x7fc2687fe700] DEBUG - Jobs: Starting child process with pid 16783 May 11, 2018 10:30:50.162 [0x7fc286bff700] DEBUG - Jobs: '/usr/lib/plexmediaserver/Plex Transcoder' exit code for process 16783 is 0 (success) May 11, 2018 10:30:50.162 [0x7fc2687fe700] DEBUG - DVR:Recorder: Comskip concatenation completed in 1.7 seconds May 11, 2018 10:30:53.945 [0x7fc2687fe700] DEBUG - Job running: '/media/plex/PlexPostProc/PlexPostProc.sh' '/media/plex/tvshows/.grab/da082c17507f5afc296758a178ce3efc56c3f3be/Sesame Street (1969) - S47E28 - Bert and Ernie Make a Movie.ts' May 11, 2018 10:30:53.947 [0x7fc2687fe700] DEBUG - Jobs: Starting child process with pid 16786 May 11, 2018 10:30:54.074 [0x7fc286bff700] DEBUG - Jobs: '/media/plex/PlexPostProc/PlexPostProc.sh' exit code for process 16786 is 1 (failure) May 11, 2018 10:30:54.074 [0x7fc2687fe700] ERROR - DVR:Recorder: Postprocessing script '/media/plex/PlexPostProc/PlexPostProc.sh' exited with error code 1. May 11, 2018 10:30:54.074 [0x7fc2687fe700] DEBUG - DVR:Grabber: Scheduling 'Sesame Street - E28 - Bert and Ernie Make a Movie' for assimilation. May 11, 2018 10:30:54.080 [0x7fc27afff700] DEBUG - DVR:Subscription: Failed to resolve subscription for episode 'grandparentGuid: com.gracenote.onconnect://show/184032 grandparentThumb: http://tmsimg.plex.tv/assets/p14598836_b_v5_aa.jpg grandparentTitle: Sesame Street grandparentYear: 1969 guid: com.gracenote.onconnect://episode/EP000037862360 index: 28 originallyAvailableAt: 2018-05-11 parentIndex: 47 title: Bert and Ernie Make a Movie type: 4 year: 2018' to library item

jeffreyswiggins commented 6 years ago

I am thinking ti must be a linux permission issue with either access to the script using the PLEX account they have built into the ubuntu install of PMS, or the PLEX accounts access to the file in the .grab folder. I can take your exact script from the PMS log and run it command just pointing to the final file no longer in the grab and it runs manually without any errors. Because of the PMS post process I can never run it manually against the file in the .grab folder as it moves it to quickly for me to test.

nebhead commented 6 years ago

Looks like the file is being passed to the script. Maybe the script isn't executable? Have you tried to run sudo chmod +x /media/plex/PlexPostProc/PlexPostProc.sh

jeffreyswiggins commented 6 years ago

Good thought... I tried it and i checked the permissions before and afterwards and nothing looks different. Also after running a recording to test I got the same result.

Here is the ls -la drwxrwxrwx 3 jeffreyswiggins jeffreyswiggins 4096 May 11 14:22 . drwxrwxrwx 8 jeffreyswiggins root 4096 May 11 09:38 .. drwxrwxrwx 8 jeffreyswiggins jeffreyswiggins 4096 May 11 07:07 .git -rwxrwxrwx 1 jeffreyswiggins jeffreyswiggins 3186 May 11 08:14 PlexPostProc.jeff -rwxrwxrwx 1 jeffreyswiggins jeffreyswiggins 3102 May 11 14:22 PlexPostProc.sh -rwxrwxrwx 1 jeffreyswiggins jeffreyswiggins 2442 May 11 07:07 README.md

nebhead commented 6 years ago

Hmmm... I'm also running this script on Ubuntu 16.04 LTS server, however, I'm running Plex in a Docker container which I given access to the script directory outside of the container. Anyway, I know we have seen an issue in other operating systems where in the script you needed to give the full path of the executable files for either handbrake or ffmpeg (depending on the branch you are using) instead of just the executable name. You could give that a try.

calederer commented 6 years ago

Have you added /media/plex/PlexPostProc/ to the PATH Environment var? I would try moving the script to $HOME/bin to see if it is an issue with bash.

If you add this to the top of the script it will echo out file durring execution and actually tell you if the script is running at all.

logfile=/usr/home/plex/bin/log.out exec > $logfile 2>&1

jeffreyswiggins commented 6 years ago

I tried a ton of things and in the end I just went back to my win7 vm and mcebuddy combo. Plex overhead is so much more on windows than Ubuntu but the simple ability to let Plex record, mcebuddy strip commercials and transcode to mp4 (plus rename it for my Plex) just outways the hours I have spent fighting unix permissions