Tuesday, November 11, 2008

Hellanzb automation with Hellavcr on Ubuntu

As a customer of a shitty ISP my bittorrent is throttled. The natural option was to move to a usenet based service. By combining the following software and services, you'll have a slick web accessible frontend for automatic downloading of your favorite TV shows. All you favourite shows will be automatically downloaded and come up on your XBMC media center.

I used an ubuntu based server for the backend, but almost any linux distro should work. It took a bit of tweaking but now I have fully automatic downloading of my favorite TV shows with zero user interaction.

Software / Services Used
XBMC (the ultimate media center front end)
- Giganews (or other usenet provider)
- Newzbin (for usenet searching and nzb downloading)
- Hellanzb (client for downloading usenet binaries)
- Hellavcr (php frontend for hellanzb)

1) Install hellanzb

sudo apt-get install hellanzb par2 unrar

2) configure hellanzb

edit /usr/etc/hellanzb.conf with your favourite editor
Update the config file, here are the important fields you'll want to update

hosts = [ 'news.giganews.com:119' ]
username = 'your username'
passwork = 'your password'
antiIdle = 0
Hellanzb.PREFIX_DIR = '/your hellanzb dir'
Hellanzb.NEWZBIN_USERNAME = ' your un'
Hellanzb.NEWZBIN_PASSWORD = 'your pw'
Hellanzb.XMLRPC_PASSWORD = 'set your pass'

3) Install Hellavcr
- Get dependencies
sudo apt-get install php5-curl php5-xmlrpc

- Restart apache
sudo /etc/init.d/apache2 restart

-download and unzip hellavcr

-unzip hellavcr to a web accessible directory (eg. /var/www/hellavcr/)

- Update file permissions

- edit hellavcr.config.php in an editor
- change the path of tv.xml to be an absolute path (eg. /var/www/hellavcr/tv.xml)
- add your newzbin login info
- change the hellanzb rpc password to the one you entered when configuring hellanzb
- disable mail and twitter if you don't use them

- hellavcr should now be web accessible

- you will need a cron job to run hellanzb.php periodically, this will check for new show releases and queue them in hellanzb. Add the following entry into your /etc/crontab to make it happen every 5 minutes

*/5 * * * * /usr/bin/php /var/www/hellavcr/hellavcr.php >> /var/log/hellavcr.log

- Go to your webserver and start searching for some shows

- The hellavcr cron job will search newzbin for the latest episodes and queue them in hellanzb

- I setup a simple script to copy the tv shows to the share that XBMC accesses, (as well as delete any sample files which came down with the video). It runs via a cron job as well

find . -printf '"%p"\n' | egrep -i sample | xargs -i rm {}
find . -printf '"%p"\n' | egrep -i chuck | egrep -i 'avi|mp4|mkv|mov|m2v' | xargs -i mv {} /fatty/video/TV\ Shows/Chuck/
find . -printf '"%p"\n' | egrep -i dexter | egrep -i 'avi|mp4|mkv|mov|m2v' | xargs -i mv {} /fatty/video/TV\ Shows/Dexter/
- On my any of my XBMC clients I update the database and the new shows appear and show up as unwatched (for easy tracking of which shows are new).



Jason Tucker said...

I was wondering if you could expand a little bit more on the cron job you have running to do the post processing and moving of your video files to the fatty drive you have going on.

Scott Gibson said...

Hey, no prob.

So in /etc/crontab I have an entry like this:

*/5 * * * * scott /hellanzb/done/move_files.sh

this call the move files script every five minutes.

The bit below is the contents of the/hellanzb/done/move_files.sh file

So line by line the file does the following

line 1: needed so the shell script to work

#! /bin/bash

line 2: find all files in the path /hellanzb/done, match only files which have the string sample in them, match only files which have the extention avi or mp4 etc, and remove them

find /hellanzb/done -printf '"%p"\n' | grep -i sample | egrep -i 'avi|mp4|mkv|mov|m2v' | xargs -i rm {}

line 3: find all files in the path /hellanzb/done, match only files with the string chuck in them, match only files with the string avi or mp4 or whatever, move the matched files to the directory /fatty/video/TV\ Shows/Chuck

find /hellanzb/done -printf '"%p"\n' | grep -i chuck | egrep -i 'avi|mp4|mkv|mov|m2v' | xargs -i mv {} /fatty/video/TV\ Shows/Chuck/

hope that helps, don't forget to make the move_files.sh script executable "chmod +x move_files.sh"

VSE said...
This comment has been removed by the author.