The goal here is to setup an automated system that check for new episodes of TV shows, download the episodes automatically, copy them to a central media PC, and rename them as needed.
Disclaimer: This info is for educational purposes only. Don’t pirate stuff, kids.
Newsgroups can be used to distribute large files. Tracking these items is handled using NZB files. Think of NZB as the newsgroup equivalent of a torrent tracker. With the NZB file of the content you want, you can download the media to your PC and watch it just like you would with a torrent.
So here’s what we are after, in a nutshell:
- Automatically Find the nzb for content you want.
- Use the nzb to download the item from a news server
- Manage the nzb and downloaded content so that files are renamed and copied to the correct folders automatically.
- Watch for new episodes and download them when available.
You will need an account on a news server. If your ISP still offers NNTP news servers then great. Otherwise you’ll need a 3rd party news source. Giganews, Easynews, Usenet, are a few examples. Most of these have a trial periods to try before you buy. Easynews has an NNTP only, unlimited account for $10 per month. For this setup, NNTP is all we need.
Next, we will need an account on a host that serves as a NZB indexer. There are a few good ones out there so try to find a private one or find one outside the US (if you have hardware and bandwidth to spare you could even run your own if you really wanted). I went with oznzb. Whichever one you choose, this will be is the source of the NZB you would use to grab media from the news server.
Now that we have services ready to go, lets setup our server. I am using an Ubuntu 10.0.4 LTS server for this example, but I’ve tested and used this on 12.04 as well.
Install sabnzbdplus using APT. SAB is the app that will manage the downloading of NZBs and their content. Think of it as a ‘uTorrent’ for news. I will also add the mobile theme in case you want to manage the app from a mobile phone. The ubuntu repo has an older version so we need to add a custom repo for the latest code:
sudo add-apt-repository ppa:jcfp/ppa sudo apt-get update sudo apt-get install sabnzbdplus sabnzbdplus-theme-mobile
Create a user called nbzd. The service can run as this user with no extra privileges.
sudo adduser nzbd
Edit the file /etc/default/sabnzbdplus and edit the file to include the nzbd user, allow hosts on network to connect using 8080.
# [required] user or uid of account to run the program as: USER=nzbd HOST=0.0.0.0 PORT=8080
Now you can start the nzbd as a service.
$ sudo /etc/init.d/sabnzbd start
Now you can access the config page and wizard at
http://server-ip:8080/sabnzbd
It will run you through a wizard to get your configuration information.
sabnzbdplus
1) Select your language
2) Select your theme
3) Select access options and id/pw.
4) Enter your Usenet provider info from whatever service you subscribed to from above.
5) If you signed up for oznzb, then enter the info here. the API key is found on the oznzb account page.
Now take some time to go through the Configs and setup your download location folders, temp folders, etc.
Now lets install SickRage. This is the app that will automatically grab nzb files for content we want to download.
SickRage is written in python. Every ubuntu server should already have python installed and ready to go. SickRage is a fork off the the very popular SickBeard. I prefer SickRage because it is updated more often, has a native email notification, and handles torrent files better then other options.
Start with getting some pre-reqs:
sudo apt-get install git-core python python-cheetah
Use git to get the latest code:
cd /opt/ git clone https://github.com/SiCKRAGETV/SickRage.git sickrage
Change owners
chown -R nzbd:root /opt/sickrage
In the sickrage folder look for directory autoProcessTV/. Rename the sample file
cd /opt/sickrage cp -a autoProcessTV/autoProcessTV.cfg.sample autoProcessTV/autoProcessTV.cfg
Edit the file and change it to support SSL if needed:
[SickBeard] host=localhost port=8081 username= password= web_root= ssl=1
Now we need to tell SABnzbd where to find the file.
Since I have SABnzbd doing different types of post processing, I create a folder and fill that folder with softlinks to the actual scripts.
mkdir /opt/sabprocessingscripts chown nzbd:root /opt/sabprocessingscripts cd /opt/sabprocessingscripts ln -s /opt/sickrage/autoProcessTV/sabToSickBeard.py sabToSickBeard.py
From the SABnzbd web pages go to FOLDERS and find the field called Post-Processing Scripts folder. Enter the path to the file we just edited:
/opt/sabprocessingscripts
Now go to the CATEGORIES link and enter a new line Enter
Category: TV
Priority: Default
Processing: Default
Script: sabToSickbeard.py
Folder: tv
Group: tv
And ADD it when done.
You can start it from the cli using
/opt/sickrage/SickBeard.py
I wanted it to start as a service so it would launch at startup as well.
To autostart SickRage as a service, we need to copy and edit 2 files.
sudo cp /opt/sickrage/runscripts/init.ubuntu /etc/init.d/sickrage sudo chmod +x /etc/init.d/sickrage
Edit the file /etc/init.d/sickrage and make sure you have the following:
# Source SickBeard configuration if [ -f /etc/default/sickrage ]; then . /etc/default/sickrage else echo "/etc/default/sickrage not found using default settings."; fi # Source init functions . /lib/lsb/init-functions # Script name NAME=sickrage # App name DESC=SickRage
Next, edit /etc/default/sickrage and add the following:
SR_HOME=/opt/sickrage/ SR_DATA=/opt/sickrage/ SR_USER=nzbd
Give the file execute permissions:
chmod +x /etc/default/sickrage
Let the service start on bootup
update-rc.d sickrage defaults
Start the service
$ /etc/init.d/sickrage start
Note: if you get any permission errors, run this:
chown -R nzbd:root /opt/sickrage
You should be able to open up the sickrage webpages now at http://server-ip:8081. You’ll want to go into CONFIG – SEARCH PROVIDERS and enter in the info for the NZB service you signed up for above or create a custom entry on that page if it is not listed.
Next we need to get SickRage working with SABnzbd. In the SickRage interface go to CONFIG -SEARCH SETTINGS. Check the box for NZB Search and select Sabnzbd+ from the list. Enter in the details for our SABnzbd install including the SAB API key which you can get from the SABnzbd web page at CONFIG -GENERAL -API. Test and Save changes when done.
Next go into SickRage web pages CONFIG – NAMING
- Pick a Name pattern that you like from the dropdown.
Under Metadata
- Use the Pulldown to select the Type depending upon what devices you have available
And with that, you should be complete. Go into SickRage, add in TV directory where you keep or want to keep you media files, and start adding shows.