How to Automate Your Always-On Raspberry Pi Download Box


We recently showed you how to turn your Raspberry Pi into a 24/7 low-power downloading machine. Now we’re back to show you how to make the system almost completely hands off with awesome automation tools.

Why Do I Want to Do This?

If you’ve been following along with our Raspberry Pi download project, at this point in the process you have a full fledged BitTorrent/Usenet machine. That’s awesome, but it’s not fully automatic. You still have to interact with the box fairly regularly to keep pointing it at new files, picking out episodes of your favorite TV shows, and so on.

After you’re done with the final segment of our Raspberry Pi download box tutorial, today’s guide on automation, you’ll have a fully automated device on your hands where all you need to do is tell it what you want and it will scout the internet for those files on your behalf.

If you haven’t been working along with us, definitely take a moment to check out How to Turn a Raspberry Pi into an Always-On BitTorrent Box and How to Turn a Raspberry Pi into an Always-On Usenet Machine.

What Do I Need?


Like the previous tutorials, for this tutorial we assume that you have a Raspberry Pi unit with Raspbian installed,  are able to access the device either directly via an attached monitor and keyboard or remotely via SSH and VNC, and that you have a USB drive (or drives) attached to it. In addition, we also assume that you’ve completed at least one (or both) of our tutorials on turning the Raspberry Pi into a BitTorrent and/or Usenet download machine. If you need to get up to speed in these areas, we strongly suggest reading the following guides in the order we have them listed here:

  1. The HTG Guide to Getting Started with Raspberry Pi
  2. How to Configure Your Raspberry Pi for Remote Shell, Desktop, and File Transfer
  3. How to Turn a Raspberry Pi into a Low-Power Network Storage Device
  4. How to Turn a Raspberry Pi into an Always-On BitTorrent Box
  5. How to Turn a Raspberry Pi into an Always-On Usenet Machine

The following sections of the tutorial and the tools contained therein will be of little use to you if you haven’t already set up your Raspberry Pi and have reached the can-access-BitTorrent/Usenet stage.

Once you are at that stage, however, it’s time to get down to the business of automating your entire build for hands-off downloading goodness.

Each section of the tutorial is independent of the others. If you want to automate television show snatching but not movie snatching, for example, you’re free to skip to the relevant portion of the tutorial and ignore the rest.

Finally, a small note about installing all the automation tools in this guide. We found that you can install them all on a Raspberry Pi without bogging the system down too severely. However, as each automation system tends to be a little heavy on the front end (when you first install it there is often a lot of heavy lifting to do like finding and downloading past episodes of television shows you want to watch), we’d suggest giving each installation a little breathing room in order to allow it to monopolize system resources, SABnzbd, and the USB HDD. Once you’re past the catch-up flurry everything should be fine, but unleashing all three automation apps side-by-side full bore in the beginning is really rough with the limited resources available to the Pi.

Installing the Dependencies

In order to use the tools outlined in this guide–SickBeard, CouchPotato, and Headphones–you’ll need to install a few dependencies before you get started. (We will not be addressing dependencies that are already installed with the default Rasbian distribution.)

Before anything else, we’re going to update and upgrade our apt-get installer. If you *just* followed along with our previous Raspberry Pi tutorials you can safely skip this as you’ve just recently upgraded.

At the terminal, enter the following commands:

sudo apt-get update
sudo apt-get upgrade

After you’ve updated/upgraded, it’s time to start installing the specific dependencies we need. First, all of the tools use the Git software source code management tool. Since Rasbian doesn’t ship with Git, we’ll need to install it. At the terminal, enter the following commands:

sudo apt-get install git-core

When prompted, press Y to continue the installation and the wait for a minute or two as the processes finishes. Afterwards, double check the installation by typing “git –version” at the prompt to check that git is installed. If it doesn’t return a version number, run the installer again.

In addition to Git, SickBeard (but not CouchPotato or Headphones) is dependent on Cheetah, a Python template tool. If you installed SABnzbd in the How to Turn a Raspberry Pi into an Always-On Usenet Machine guide, you already have Cheetah installed. If you only followed along with the BitTorrent guide, you’ll need to install it. At the terminal, enter the following command:

sudo apt-get install python-cheetah

After installing Git and Python-Cheetah (if you’re planning on using SickBeard for TV shows), we’re ready to get started.

Installing and Configuring SickBeard on Raspbian


SickBeard is a television management tool for Usenet and BitTorrent downloads–the Usenet support is significantly more mature than the BitTorrent support, but they’re both functional. In a nut shell, you tell SickBeard what TV shows you want to watch and it acts like an Internet-powered TiVo, downloading those shows for you (either from a backlog if you’re catching up or as they are released if your show collection is up to date). It’s a fantastic way to stay on top of your favorite programs.

Installing SickBeard: To install SickBeard, open up the terminal and enter the following command:

git clone git://

Once the installation is complete, switch to the SickBeard directory and run SickBeard for the first time:

cd Sick-Beard

It will appear to hang for a moment, and then you’ll see a verbose SickBeard script whiz by, and then idle. At this point, you can hop into a web browser and point it at the following address to check SickBeard out:

http://[Your PI's IP Address]:8081/home/

Configuring SickBeard: Unlike some of the tools we’ve used in the previous tutorials, SickBeard doesn’t have a configuration wizard to walk us through the setup. We’ll walk you through the important steps now.  We’ll list the relevant items you’ll want to change by their section within the Configuration portion of SickBeard’s interface.

In the Config -> General section:

Uncheck Launch Browser: We’re going to be accessing the box remotely, there’s no need for this resource-wasting option.

Under Web Interface: You can, if you wish, add a username and password to SickBeard and/or change the port number.

In the Config -> Search Settings section:

Here, we configure SickBeard to work with our Usenet and/or BitTorrent client. SickBeard really shines with Usenet and we encourage you to go that route.

Adjust Usenet Retention: The default is 500 days. If you have a premium Usenet provider, your retention should be much higher, usually 1100+ days. Check with your provider and fill in the appropriate number here.

Under NZB Search, make sure “Search NZBs” is checked, and that you’ve selected SABnzbd. Plug in the URL, username and password (if you set one), and the API key from your SABnzbd installation. Click “Test SABnzbd” when you’re done to make sure SickBeard can successfully communicate with it.

Note: If you’re set on using BitTorrent, you’ll need to check “Search Torrents” and set the watch folder for your Torrent client.

In the Config -> Search Providers section:

Here, you can select which indexes to search and input your API keys for private/pay search indexes.

Under Provider Priorities, you can check to enable providers and then drag and drop them in the list to prioritize them. By default, Womble’s Index is checked. You can check Sick Beard Index and nzbX, but the rest of them require accounts with API keys–you’ll need to visit the respective websites and go through the signup process to use them.

Note: If you turned on torrent searching in the previous step, you’ll also see TV torrent trackers listed here.

In the Config -> Post Processing section:

In the initial “Post-Processing” section, leave the “TV Download Dir” blank. We’re going to set up a helper script for SABnzbd that will take care of this function. Uncheck “Keep Original Files”; we don’t have the space on our mini Pi server to store duplicates of everything we download. Check “Move Associated Files” and “Rename Episodes” so that SickBeard will move any additional files downloaded with your TV content and rename the shows with the convention you select in the “Naming” section.

Finally, you can have SickBeard download metadata in the format that suits your media center setup. Since we use all XBMC installations, we selected XBMC for our “Metadata Type” and checked all the metadata file types we wanted SickBeard to create (like folder images and fanart).

In the Config -> Notifications section:

This section is entirely optional. You can setup notifications on your media clients (such as XBMC) and notification services such as Growl. The XBMC notifications can be extremely handy if you want a fully automated system as you can set SickBeard to force XBMC to perform library updates after new shows are downloaded.

Linking SABnzbd and SickBeard: Properly configured SickBeard and SABnzbd have a nice symbiotic relationship. You can set it up so SickBeard finds the shows, kicks the NZB files over to SABnzbd, and then SABnzbd in turn calls on a SickBeard helper script to post-process all the shows and transfer them to their appropriate folders. Once configured, the process is completely seamless.

In order to link the two together, we need to copy the helper script and edit the very tiny configuration file that accompanies it. First, enter the following command at the terminal to take you to the folder where the two files are located:

cd /home/pi/Sick-Beard/autoProcessTV

Inside that directory are the two files we care about: (the helper script) and autoProcessTV.cfg.sample (the sample configuration file). Let’s open the configuration file and make changes. Enter the following command:

nano autoProcessTV.cfg.sample

In the nano editor, double check that everything in the simple configuration file matches your installation. By default, the config file points at the local host, on port 8081, with no username or password. If you have changed any of the settings (such as the port number or by adding in a username/password), edit the file to reflect that. When you are done, press CTRL+X to exit. Change the filename to autoProcessTV.cfg (dropping the .sample from the end).

There are two ways to give SABnzbd access to the scripts. The lazy way is to just change the post-processing script directory in SABnzbd’s Config -> Folder section to /home/pi/Sick-Beard/autoProcessTV. If the SickBeard scripts are the only post processing tools you use, this will work fine.

Alternatively, if you want to keep all your SABnzbd scripts in one location, you can use the following command to copy them to your SABnzbd scripts folder (the folder we setup in the Usenet guide):

cp autoProcessTV.cfg /media/USBHDD1/shares/SABnzbd/scripts

Either way, once you have the scripts configured and copied, you need to tell SABnzbd to use them. In SABnzbd, navigate to Config -> Categories and create a new category “tv”. In the script section select as your post-processing script. If you wish to create a folder where your TV downloads will be temporarily sequestered from your other downloads before being shuffled off to the permanent TV folder, you can set a Folder/Path (e.g. SickBeardTV). Make sure to hit the Add button to save your changes.

Adding Shows to SickBeard: Now that you’ve configured SickBeard, it’s time for the most important part: adding television shows to your new automated system.

First, we need to make a directory for SickBeard to store the shows. (If you already have a TV show directory set up on the external hard drive you’re using with your Pi, skip this step). At the terminal, enter the following command (altering the pathname if you’re not using the same setup we established previous tutorials):

mkdir /media/USBHDD1/shares/TV/

Now, from the main SickBeard interface, click on Add Shows (located on the secondary navigation bar in the upper left hand corner). You have two options for adding shows into the system: you can create a new entry for a new show or you can import TV shows you have already downloaded into system. Even if you don’t have an existing TV show collection to add to SickBeard, we still need to start with the “Add Existing Shows” button in order to point SickBeard at our TV show directory (regardless of whether it is empty or full).

Click on Add Existing Shows, and then under the Manage Directories tab, click New. Select your TV folder in the file explorer. After you click OK, click Set as Default and then Submit at the bottom of the page.

Once you have the default TV directory set up, you can navigate to Add Shows -> Add New Show to add a TV show to your collection. Enter a full or partial show title in the search box, search for it, and then select the show you wish to monitor and download. Click next to double check the folder it will be deposited in and next again to tell SickBeard whether you want the missing episodes to be flagged as Wanted or Skipped, as well as the video quality of the download. If everything looks good, click Add. You’ll be returned to your show list and SickBeard will create the folder for the show, download the meta data, and begin looking for episodes. (If you don’t want to wait for the timer to count down to the next episode search, you can click on Manage -> Backlog Overview to force a search immediately.)

Running SickBeard on Startup: There is one final step for the SickBeard configuration process; we’re going to add a small startup script to launch SickBeard on boot. There’s no point in having an automated TV show downloader, after all, if you have to manually start it up. We’ve created enough of these startup scripts in the previous Raspberry Pi as Download Box tutorials that we’re just going to list off the commands you need to enter without a detailed step-by-step break down.

Enter the following commands at the terminal to copy the startup script, change the permissions, and update the startup files:

sudo wget -O /etc/init.d/sickbeard/

sudo chmod 755 /etc/init.d/sickbeard

sudo update-rc.d sickbeard defaults

That’s all there is to it, now you’re ready to go! Add old shows you wish you would have watched, add shows you’re currently watching, add shows that haven’t even aired yet but you’d like to watch. SickBeard will seamlessly and automatically download them all for you.

Continue reading to learn how to setup CouchPotato for automated movie downloading.

Jason Fitzpatrick is a warranty-voiding DIYer who spends his days cracking opening cases and wrestling with code so you don't have to. If it can be modded, optimized, repurposed, or torn apart for fun he's interested (and probably already at the workbench taking it apart). You can follow him on if you'd like.