Some people would say that I’m a lazy person, that I don’t want to do anything which requires any hard work. But I prefer to think of myself as efficient – Doing repeated complex tasks over and over irritates me, like scouring index sites for my favourite Linux isos. When a new version appears, it should magically appear in a folder on my server, right?
Thankfully, with a few programs and a bit of time spent on the front end, it can all be magically done for you.
I’ll be doing all of this on Ubuntu 10.04, as that’s my server operating system of choice. If you want to build this setup on a different system, your mileage may vary. Just be sure to check the individual requirements of each package to ensure that they’ll all work correctly (i.e. HellaVCR needs Apache to work).
- A usenet provider like Giganews or Astraweb. (If you’re an Internode user, you have free access to Astraweb)
- SABnzbd+, a newsreader client
- HellaVCR, a download automator
- an account at Newzbin or NZBmatrix, for searching and downloading NZBs.
Step 1: Install SABnzbd+
There’s a version of SABnzbd+ within the standard Ubuntu 10 repositories which is known as sabnzbdplus, but that’s generally a few versions old. If you prefer to stick with the latest and greatest, follow these steps:
Add a new entry to your apt sources.list
echo "deb http://ppa.launchpad.net/jcfp/ppa/ubuntu $(lsb_release -c -s)
main" | sudo tee -a /etc/apt/sources.list
And its associated GPG key
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:11371 --recv-keys
Update to check for new packages
sudo apt-get update
Install SABnzbd+ as well as its requirements
sudo aptitude --with-recommends install sabnzbdplus
Start the program with
Step 2: Configuring SABnzbd+
There are more options in SABnzbd+ than you can shake a stick at, like automatic sorting, scheduling download times (so they marry up with your peak/off-peak times) and so on. I’ll cover the major bits you’ll need to get your download system off the ground, and you can poke about from there to see what else you want to change.
Change the SABnzbd username and password if you want to lock down the web interface. Handy if you plan on allowing access remotely and don’t want nosy people getting in and seeing what you’re downloading.
Take a copy of the API Key. We’ll need it for HellaVCR.
Set up the folders where you want your incomplete and complete files to be stored.
Enter the details of your Usenet provider and press “Add Server.”
If desired, SABnzbd+ can start and stop downloads at certain times. Add pause and resume times to create a schedule.
Set up email notification so you’ll be alerted when a download completes, if desired.
Without this, you won’t be able to download any NZBs, and the whole shebang will stop working. Fill in your Newzbin username and password or NzbMatrix username and API key.
Here you can define how SABnzbd+ sorts and renames your downloads once they’re finished. This means that you’re not lumbered with the horrible naming convention that the uploader chose to use when encoding the files. Personally I prefer the following:
%sn/Season %0s/%sn - %0sx%0e - %en.%ext
Which translates to: /tank/sab/complete/Show Name/Season 01/Show Name – 01×05 – Episode Name.avi
Step 3: Install Apache
Download and install Apache with apt
sudo apt-get install apache2
Wow, that was tough. I think I need a rest.
Step 4: Install HellaVCR.
You’ll need a couple of bits and pieces before HellaVCR will work correctly:
sudo apt-get install php5-curl php5-xmlrpc
and you’ll need to restart apache so they take effect
sudo /etc/init.d/apache2 restart
Then download HellaVCR from http://code.google.com/p/hellavcr/ and extract it to your preferred folder. I have mine in /var/www/hellavcr/, but you might prefer to put yours elsewhere.
Step 5: Configure HellaVCR.
TV.xml and the posters directories need to be writable by the system, so use chmod:
chmod -R 0666 /var/www/hellavcr/posters chmod 0666 /var/www/hellavcr/tv.xml
Then fire up your favourite text editor (nano, vim, gedit, etc), open hellavcr.config.php and change the following fields:
‘xml_tv’ => change to a direct path, e.g. /var/www/hellavcr/tv.xml
‘nzb_site’ => change to newzbin or nzbmatrix, depending on which you’re using.
‘nzb_handler’ => change to sabnzbd
‘sabnzbd_server’ => set to localhost, or the IP address of your SABnzbd if it’s on a different computer
‘sabnzbd_port’ => leave as 8080
‘sabnzbd_apikey’ => paste in the API key you got from SABnzbd+ earlier
‘sabnzbd_username’ => the username you entered in SABnzbd+ earlier
‘sabnzbd_password’ => same again
Step 6: Add some TV shows.
Browse to http://localhost/hellavcr/ and you should find the main screen of HellaVCR. Click “Add Show” and follow the prompts, to create a show entry. This show will automatically be checked on TVRage.com and your NZB site of choice to download new episodes.
Once it’s set up, you can fire off a HellaVCR scan manually by browsing to the folder where HellaVCR is installed and typing the following:
sudo php hellavcr.php
You’ll see hellavcr parse through each show and check for updates. If there are any, they’ll automagically be sent to SABnzbd+, where they’ll either download immediately or when your next scheduled download time is.
Step 7: Automate the process.
The last thing to create is a way for HellaVCR to scan every fifteen minutes or so, ensuring that you’re totally up to date with what’s going on. Open up your text editor and create a new file at /var/www/hellavcr/hella.cron with the following info:
*/15 * * * * /usr/bin/php /var/www/hellavcr.php >>/var/log/hellavcr.log
and add it to your crontab:
sudo crontab /var/www/hellavcr/hella.cron
This cron will then execute a HellaVCR scan once every fifteen minutes and drop the output into /var/log/hellavcr.log. If you want to change the times so the scan happens less or more often, read man crontab.
Bonus Step: Twitter Integration.
While there’s email integration in SABnzbd+, I prefer to receive a tweet when something of importance happens. Set up a second twitter account and lock it so that nobody but you can see the twitter stream – after all, we don’t want any nosy people knowing what we’re downloading. For the purposes of this demonstration, the twitter account will be @loldownload
First, make sure that php-curl is installed
aptitude install php5-curl curl
Tweet when a HellaVCR scan is complete.
Instead of setting up a raw cron to run php hellavcr.php, create a script to perform this task and then tweet when finished:
#!/bin/bash cd /var/www/hellavcr/ php hellavcr.php > hella.log curl -u loldownload:password -d status="@yourname HellaVCR Scan Complete" http://twitter.com/statuses/update.xml
Make the script executable
chmod +x hellatweet.sh
Once cronned, it’ll send a mention to you when it performs a scan. This could be annoying if you scan every fifteen minutes, though.
Tweet when a show is scheduled in for download.
Set ‘twitter’ to true. Set ‘twitter_username’ to ‘loldownload’ and ‘twitter_password’ to whatever your loldownload password is.
Tweet when a download completes.
In SABnzbd+, go to Config>Folders and make note of the Post-Processing Scripts Folder. If there isn’t one there by default, create a folder somewhere in your SAB area and enter it here.
In the script folder, create a new bash script to automatically send a tweet when a download completes.
# nano tweet.sh
#!/bin/bash echo "- Tweet, Tweet!" curl -u loldownload:password -d status="@yourname Just finished download ing $3" http://twitter.com/statuses/update.xml
Save the file and make it writable
chmod +x tweet.sh
Finally, tell SABnzbd+ that it should assign this as the default script when it queues a file so it’ll automatically tweet at the end of each download.
In SABnzbd+ go to Config>Switches. Choose your script in the dropbox marked Default User Script. You should probably also set the default post-processing to +Delete, and the priority to Normal.
One thought on “Automating Usenet downloads with HellaVCR and SABnzbd+”
Thanks for the write-up. I had Hellavcr in place, but wasn’t quite sure what to do with it. I do have a couple of questions.
I started off with hellanbz, and created a home directory to save files. I also created a script to automagically place the incoming files into the appropriate directories. So do I though all of that stuff out of the water?
I guess I could change the script to read the new “done” directory and have the same effect.
I am with you on automations… So what did you do to autoget movies, and of course automatically files those for the benefit of my xbmc solution?