Tv show downloader for a linux server.... Part 1

Ok, I am going to put together a automatic TV show downloader that uses the RSS feed generated from showrss. The downloader server is headless so everything not only needs to be command line, but also run as a service and crontab entry. I have extra needs such as the torrent needs to stop seeding very soon after downloading because I live in a non-free country (USA) where you are persecuted for downloading a TV show you can easily record off of the Satellite TV I already pay for. I dont want to use their DVR, I want to use XBMC so I can have subtitles as well as a far superior scan converter.

Step 1 Set up your RSS feed at showrss. everything that is in this feed will be downloaded so dont go nuts.

Step 2 install rtorrent and screen on your server... Ubunto did both easily by using the following commands....

sudo apt-get install rtorrent
sudo apt-get install screen

configure rtorrent to watch a directory. set up your .rtorrent.rc file as follows....

# This is a resource file for rTorrent.

# Default directory to save the downloaded torrents.
directory = /home/timgr/torrents

# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session= /home/timgr/torrents/rtorrent.session

# Watch a directory for new torrents, and stop those that have been
# deleted.
schedule = watch_directory,5,5,load_start=/home/timgr/torrents/*.torrent
#schedule = untied_directory,5,5,stop_untied=

scgi_port = 127.0.0.1:5000
encryption=require

# Enable the default ratio group.
ratio.enable=

# Change the limits, the defaults should be sufficient.
ratio.min.set=1
ratio.max.set=1
ratio.upload.set=1M

# Changing the command triggered when the ratio is reached.
system.method.set = group.seeding.ratio.command, d.close=, d.erase=

#Sort file
system.method.set_key = event.download.finished,move_complete,"d.set_directory=/home/timgr/TV/;execute=mv,-u,$d.get_base_path=,/home/timgr/TV/"
system.method.set_key = event.download.hash_done,sort_finished,"branch=$d.get_complete=,\"execute={~/scripts/torrentSorter.py,$d.get_base_path=}\""

This setup will stop seeding and delete the .torrent at 1% ratio or 1Meg downloaded whichever is first. It also sets up encrypted only and it moves the finished files to a different directory. I need to figure out how to stop seeding and delete the .torrent when download is finished, but right now it segfaults when you set it up to do that.

I now have a system that will automatically download any .torrent that appears in the /home/timgr/torrents directory, and when finished it moves them to the /home/timgr/TV directory.

I now need to write a script that I run with crontab every 20 minutes to grab the rss feed, and download all the .torrent files listed in it and put them in the /home/timgr/torrents directory. This will auto-feed the rtorrent program as the torrents are released.

Step 3 will be writing a sorting system that will take the files, clean up the naming and sort them into directories on the NAS that holds all the TV recordings.

Finally in Step 4 we will clean it all up and automate it so that on reboot everything starts automatically and rtorrent runs as a "service"

That's it for step 1, Step 2 will be the code to grab the feed...

Comments

Popular Posts