Mar 16 2008

MythTV, TV torrents, and RSS

Along with our phone -> VOIP conversion, we simultaneously canceled our cable. I'll consider re-subscribing when I can get channels and/or shows a la carte.

We've been using a MythTV for about 2 years now, and without using the capture card directly anymore, I wanted to hook it into TV Torrents and TV RSS show feeds.

There used to be a project to integrate all of this stuff together called Torrentocracy, but as of this writing it appears to be dead. Webpage simply states "The torrentocracy project is no longer active." Thanks for not leaving a legacy download link or anything, guys. Why even keep the domain registered?

Ok, fine. Doing something similar manually isn't tough. The method I use doesn't integrate perfectly with the MythTV, but it's good enough to get new shows without interaction, and Nadine can just snag torrents and put them in a network directory to have them magically appear on the TV.

First off, I needed a torrent client that supports 'watching' a directory for new torrents, and stopping them after a certain ratio. I like using RTorrent. Super configurable and feature rich. The only torrents the MythTV will download will be shows, so I opted to put all new content into an incoming folder under the MythTV videos folder. Relevant parts of the .rtorrent.rc:

# define our working environment
working_directory = /var/lib/mythtv/videos/incoming
directory = /var/lib/mythtv/videos/incoming
session = /var/lib/mythtv/videos/incoming/.session

# put a small ceiling cap on upload rates during the day,
# but let 'er rip at night.  (100k uploads vs no limit.)
schedule = throttle_1,23:00:00,24:00:00,upload_rate=0
schedule = throttle_2,06:00:00,24:00:00,upload_rate=100

# auto start/stop torrents based on files in the specified dir
schedule = watch_directory,10,10,load_start=
schedule = tied_directory,10,10,start_tied=
schedule = untied_directory,10,10,stop_untied=

# auto-stop torrents on an even ratio.
# use shift-I to ignore/override per torrent
schedule = ratio,60,60,stop_on_ratio=100,0

This config causes rtorrent to automatically download any torrent files it sees in /var/lib/mythtv/videos/incoming, and stops them once we hit a 1:1 ratio.

Now, to fetch torrent files, I wrote a quick-n-dirty ruby script (you can snag it here) that looks for a rss_sources.txt file. This file should contain a bunch of links (one per line) to RSS show feeds. TV RSS is great for this, as is TV Torrents -- though you need to donate to gain access to the TvTorrent feeds. It connects to each feed, and downloads new torrents for the rtorrent client to pick up and manage.

With that script in an hourly crontab, the shows we're interested in simply appear on the MythTV. We lose the ability to "channel surf", but after adjusting our viewing habits, that is ending up to be a very good thing.

Update 2010/05: I switched to using FlexGet and Boxee, and am deliriously happy.

Update 2015/03: Boxee declined to obvilion, switched again to Plex soon afterwards (2011, I think?) Still using flexget, but also switched to Transmission for torrents. I can't recommend Plex highly enough.