How to have Plex automatically Update Library when Sabnzbd finishes a download

Plex does not yet have the ability to automatically watch your media sources and Update the Library any time something is added. However, there is a way to get around this. We can set Sabnzbd to tell Plex to run Update Library whenever it finishes downloading a new episode.

#!/bin/sh
curl --get "http://localhost:3000/xbmcCmds/xbmcHttp?command=ExecBuiltIn¶meter=XBMC.updatelibrary(video)"

First we need to create the update script. Fire up your text editor of choice and paste the above code into a new document.

Plex Sabnzbd 2

Make sure to change localhost to the IP address of of the computer running Plex if it is running on a different computer.

Plex Sabnzbd 1

Save the file as UpdateLibrary.sh in ~/Library/Scripts/Sabnzbd. If the directory does not already exist then you will need to first create it.

Plex Sabnzbd 3

Open up Sabnzbd in your browser. Go to the Folder Settings page (the location of this may vary depending on the theme you are using). Set “Folder Containing the User Scripts” to Library/Scripts/Sabnzbd. Make sure to save your changes. Now for the next step

Media 1252883961838

Go to the Switches page in the Sabnzbd configuration. Under Processing Switches there is a Default User Script dropdown. Change it from None to UpdatePlexLibrary.sh. Make sure to save your changes. Now scroll down to the bottom of this post to add some finishing touches.

Finishing touches

Media 1252884866077

Now to add just a bit more polish. Open up Plex. Go to Preferences > Video > Library. Turn on Update library on startup (the script only works if Plex is open, but this option takes care of if it’s closed when the download finishes) and Always update library in background (this will suppress the Updating library box from popping up). That’s it. You are done. Now anytime Sabnzbd finished downloading an episode it will automatically be added to Plex.

comments powered by Disqus