Plex Media Server Integration

MCEBuddy’s core use case for me is with Plex Media Server. I think there’s an API to allow for an update of the library - any chance if integrating that into the offering?

I haven’t found it an issue or need to keep my Plex Media Server up-to-date more frequently than a daily sync. If you’re recording something for later watching, I’m not sure of the use case for near-real-time watching in Plex when you could just watch the original broadcast recording, yes?

What is the scenario you need to get immediate Plex library metadata updates to sync with MCEBuddy?

It’s as a result of the commercial skipping workflow being broken since 1.18.5.x.

Since that release, the commercials are no longer being cut - even if the EDL file is created. The work around is to disable the post-processing script, have MCEBuddy monitor locations for .TS files, and then run the conversion task as appropriate (either cutting out commercials or not, depending on where the recording is).

The challenge is that the .ts files are changed to .mkv as part of this - the only way to get Plex to pick back up the new file is to have it rescan. I’ve got it turned up to scan every 15 minutes, but it would be much more elegant to run it as the last step of MCEBuddy’s conversion.

If you’re just triggering a rescan of your PMS, have you tried creating a PostCustomCommand with a curl command and passing the URL + token + library id of your PMS as the parameters?

Something like this in Windows 10:

PostCustomCommandPath=C:\Windows\System32\curl.exe
PostCustomCommandParameters=http://[PMS_IP_ADDRESS]:32400/library/sections/[your_library_id]/refresh?X-Plex-Token=[YourTokenGoesHere]
PostCustomCommandHangPeriod=30
PostCustomCommandCritical=false
PostCustomCommandUISession=false
PostCustomCommandShowWindow=false
PostCustomCommandExitCodeCheck=false

@Goose, I hadn’t thought about the postprocessing part in MCEBuddy. Do I just append the postcustomcommand at the end the profile?

Thanks! Will.

That worked great - surprisingly easy to do, and works beautifully!

1 Like

@Goose, If I wanted to add a delay, can I point it at cmd.exe and call a batch file instead?

I don’t see a reply to your question… Are the postcustomcommand lines appended:
A. In the profiles.conf file at the end of the section of the profile one is using (e.g. for Plex, [TS Unprocessed])? OR,
B. In the mcebuddy.conf at the end of the section of the conversion task (e.g. “My TVShow Comm. Removal”?

Thanks
Dave

I haven’t played with it much beyond calling curl - I didn’t get it to work with a batch file, but I also didn’t try very hard.

This works:

[HEVC MKV]
Description=HEVC in MKV (H.265/AC3) conversion. Creates a smaller file (50% smaller than H.264) with comparable quality but very slow.
order=handbrake,ffmpeg
ffmpeg-general=-threads 0
ffmpeg-video=-ss 3 -vf yadif=0:-1:1,hqdn3d -vcodec libx265 -preset medium -x265-params crf=18 -map 0:v -sn
ffmpeg-audio=-acodec ac3 -ab 160k -map 0:a
ffmpeg-audioac3=-acodec ac3 -ab 256k -map 0:a
ffmpeg-ext=.mkv
ffmpeg-audiodelay=skip
handbrake-general=--decomb --loose-anamorphic --verbose=2
handbrake-video=--start-at duration:3 -e x265 --encoder-preset medium -q 18
handbrake-audio=-E ffac3 -R auto -B 160 -D 0 -a 1,2,3,4,5
handbrake-audioac3=-E ffac3 -R auto -B 256 -D 0 -a 1,2,3,4,5
handbrake-ext=.mkv
handbrake-audiodelay=skip
PreConversionCommercialRemover=true
PostCustomCommandPath=C:\Windows\System32\curl.exe
PostCustomCommandParameters=http://192.168.8.9:32400/library/sections/1/refresh?X-Plex-Token=<my plex token>
PostCustomCommandHangPeriod=30
PostCustomCommandCritical=false
PostCustomCommandUISession=false
PostCustomCommandShowWindow=false
PostCustomCommandExitCodeCheck=false

Yes you can do any combination that works for you, here’s an example of have MCEBuddy invoke CMD which in turn invokes another program:

CustomCommandPath=C:\Windows\System32\cmd.exe
CustomCommandParameters=/c ""<Path to batch file or exe>" <parameters for batch or exe>"

Would I need the double quotes in the second line if there are no parameters?

There are two double quotes which are independent of each other (this not specific to mcebuddy but in general how CMD works)

  1. If the batch/exe file path has spaces, then that’s the inner quotes.
  2. The second set quotes encapsulates both the batch/exe and parameters. If you don’t have any parameters to pass to the batch/exe then you don’t need the outer quotes.

what does the /c switch do?