Adding Automatic XBMC Library Update with Sabnzbd Post Processing

I’ve previously written a post about my home theater setup using an AppleTV, Plex, Sickbeard and Saznzbd+. This was all fine, however just before Christmas I thought I’d splash out and get myself a dedicated HTPC. There were a few issues with my previous setup. Firstly it appeared that the Plex for AppleTV wasn’t really being very well supported, and as new iOS versions were being released they weren’t getting Plex support. Using the older versions of the iOS was part of the problem. Secondly I didn’t want to always have a second computer in my house always running, acting as my Plex server.

So I decided to spend some money and get a HTPC. I still had two choices, to build my own or to buy a Mac Mini. I ended up building, but I have to say it was a bad choice. I only saved a small amount compared to the Mini, and despite the fact that I can add extra peripherals it’s unlikely I will. All the hassle you go through trying to make it silent, getting remotes to work correctly and installing an OS already makes it more expensive in my mind.

Despite the trials of this build I finally got it all up and running just as I wanted. It’s an Ubunutu machine running XBMC. Of course it also has Sickbeard and Sabnzbd. I thought today I’d share something that I should have done day one of my build and that’s getting XBMC to update when a new show is completed downloading in Sab. Unfortunately unlike Plex which updates itself (very efficiently), XBMC will only do so when you tell it to. Luckily Sabnzbd comes with the ability to run user defined scripts after post-processing. We’ll first need to install ‘xbmc-send’, a command line tool that allows us to send commands to XBMC.

sudo apt-get update
sudo apt-get install xbmc-send

Having done this you can test it is working by sending the following command.

xbmc-send –a "Notification('Message', 'Hello World')"

You will see a notification appear on the screen in XBMC.

Next we need to create a shell script to do our update command.

#!/bin/bash
# Update XBMC Library
/usr/bin/xbmc-send -a "UpdateLibrary(video)"

Just use your favorite text editor to save the script somewhere. I created a directory where my Sabnzbd ‘complete’ and ‘incomplete’ directories are. Next in Sabnzbd head to ‘Configure > Profiles’ and enter your scripts directory in the ‘Post-Processing Scripts Folder’. Finally go to ‘Configure > Categories’ and under your ‘TV’ and ‘Movies’ choose your script from the drop down and save.


Posted

in

by

Tags: