# Plex Media Server Integration

**URL:** https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521
**Category:** Plex
**Tags:** tweaking
**Created:** [March 30, 2020, 11:27pm UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521 "2020-03-30T23:27:00Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Will\_Tschumy](https://discussion.mcebuddy2x.com/letter_avatar_proxy/v4/letter/w/ecc23a/32.png) [@Will\_Tschumy](https://discussion.mcebuddy2x.com/u/Will_Tschumy)
#### Post date: [March 30, 2020, 11:27pm UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521/1 "2020-03-30T23:27:00Z")

</div>

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?

> **[Plex Media Server URL Commands | Plex Support](https://support.plex.tv/articles/201638786-plex-media-server-url-commands/)**
>
> If you’re familiar with interpreting XML, you can gather information about your Plex Media Server. You might like to do...

---

<div class="post-metadata">

### Author: ![mike808](https://discussion.mcebuddy2x.com/letter_avatar_proxy/v4/letter/m/c5a1d2/32.png) [@mike808](https://discussion.mcebuddy2x.com/u/mike808)
#### Post date: [March 31, 2020, 3:06pm UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521/2 "2020-03-31T15:06:25Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Will\_Tschumy](https://discussion.mcebuddy2x.com/letter_avatar_proxy/v4/letter/w/ecc23a/32.png) [@Will\_Tschumy](https://discussion.mcebuddy2x.com/u/Will_Tschumy)
#### Post date: [March 31, 2020, 4:43pm UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521/3 "2020-03-31T16:43:23Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Goose](https://discussion.mcebuddy2x.com/letter_avatar_proxy/v4/letter/g/5f9b8f/32.png) [@Goose](https://discussion.mcebuddy2x.com/u/Goose)
#### Post date: [April 1, 2020, 8:47pm UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521/4 "2020-04-01T20:47:40Z")

</div>

If you’re just triggering a rescan of your PMS, have you tried creating a [PostCustomCommand](https://discussion.mcebuddy2x.com/t/mcebuddy-advanced-settings-commands-and-tweaking/30/1#customcommands) with a `curl` command and passing the URL + token + library id of your PMS as the parameters?

Something like this in Windows 10:

```auto
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

```

---

<div class="post-metadata">

### Author: ![Will\_Tschumy](https://discussion.mcebuddy2x.com/letter_avatar_proxy/v4/letter/w/ecc23a/32.png) [@Will\_Tschumy](https://discussion.mcebuddy2x.com/u/Will_Tschumy)
#### Post date: [April 3, 2020, 3:37pm UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521/5 "2020-04-03T15:37:19Z")

</div>

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

Thanks! Will.

---

<div class="post-metadata">

### Author: ![Will\_Tschumy](https://discussion.mcebuddy2x.com/letter_avatar_proxy/v4/letter/w/ecc23a/32.png) [@Will\_Tschumy](https://discussion.mcebuddy2x.com/u/Will_Tschumy)
#### Post date: [April 3, 2020, 4:59pm UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521/6 "2020-04-03T16:59:18Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Will\_Tschumy](https://discussion.mcebuddy2x.com/letter_avatar_proxy/v4/letter/w/ecc23a/32.png) [@Will\_Tschumy](https://discussion.mcebuddy2x.com/u/Will_Tschumy)
#### Post date: [April 4, 2020, 7:52am UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521/7 "2020-04-04T07:52:23Z")

</div>

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

---

<div class="post-metadata">

### Author: ![MalibuDave42](https://discussion.mcebuddy2x.com/letter_avatar_proxy/v4/letter/m/d9b06d/32.png) [@MalibuDave42](https://discussion.mcebuddy2x.com/u/MalibuDave42)
#### Post date: [April 23, 2020, 4:54pm UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521/8 "2020-04-23T16:54:01Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Will\_Tschumy](https://discussion.mcebuddy2x.com/letter_avatar_proxy/v4/letter/w/ecc23a/32.png) [@Will\_Tschumy](https://discussion.mcebuddy2x.com/u/Will_Tschumy)
#### Post date: [April 23, 2020, 5:33pm UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521/9 "2020-04-23T17:33:45Z")

</div>

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
```

---

<div class="post-metadata">

### Author: ![Goose](https://discussion.mcebuddy2x.com/letter_avatar_proxy/v4/letter/g/5f9b8f/32.png) [@Goose](https://discussion.mcebuddy2x.com/u/Goose)
#### Post date: [April 23, 2020, 5:41pm UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521/10 "2020-04-23T17:41:04Z")

</div>

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:

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

```

---

<div class="post-metadata">

### Author: ![Will\_Tschumy](https://discussion.mcebuddy2x.com/letter_avatar_proxy/v4/letter/w/ecc23a/32.png) [@Will\_Tschumy](https://discussion.mcebuddy2x.com/u/Will_Tschumy)
#### Post date: [April 23, 2020, 5:48pm UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521/11 "2020-04-23T17:48:10Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Goose](https://discussion.mcebuddy2x.com/letter_avatar_proxy/v4/letter/g/5f9b8f/32.png) [@Goose](https://discussion.mcebuddy2x.com/u/Goose)
#### Post date: [April 23, 2020, 6:09pm UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521/12 "2020-04-23T18:09:47Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Will\_Tschumy](https://discussion.mcebuddy2x.com/letter_avatar_proxy/v4/letter/w/ecc23a/32.png) [@Will\_Tschumy](https://discussion.mcebuddy2x.com/u/Will_Tschumy)
#### Post date: [April 23, 2020, 8:55pm UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521/13 "2020-04-23T20:55:40Z")

</div>

what does the /c switch do?

---

<div class="post-metadata">

### Author: ![Goose](https://discussion.mcebuddy2x.com/letter_avatar_proxy/v4/letter/g/5f9b8f/32.png) [@Goose](https://discussion.mcebuddy2x.com/u/Goose)
#### Post date: [October 2, 2020, 3:53pm UTC](https://discussion.mcebuddy2x.com/t/plex-media-server-integration/3521/15 "2020-10-02T15:53:44Z")

</div>


