::::: : the wood : davidrobins.net

rTorrent patch, periodic torrent download

News, Technical ·Wednesday October 21, 2009 @ 03:58 EDT (link)

I patched rTorrent to fix a crash on setting a torrent to erase on finishing. There was an existing ticket, so I added my patch to it. rTorrent is an ncurses BitTorrent client that works well under GNU screen, but it's best features are a programmable API (XMLRPC over SCGI) and use of directory monitoring (drop a .torrent file in a directory, it'll start downloading) and status files (it can easily be set to create a symlink with the name of the torrent file + .finished, pointing to the download, when the download is complete).

rTorrent is the largest piece in automating weekly downloads of TV shows that we watch; the rest is a few scripts—Python, not Perl, to branch out a little. I also have a perl program that will rename and file downloaded episodes according to their names from epguides.com; I'll connect it up to auto-rename finished downloads. The other piece of the puzzle is the isoHunt JSON search API. Three programs need finishing:
  1. grabber - given a search spec, such as "House S06E05", query isoHunt and return good torrents (removing listings with poor scores, too few S/L, possibly negative comments, or that aren't plain AVI files), downloading the best one and moving it to the rTorrent watch directory to start a download.

  2. monitor - check the rTorrent watch directory for finished files; remove the .finished indicator and run the episode renamer on the target; add a symlink to a "new downloads" folder.

  3. scheduler - given a show and its day/time, look it up on epguides.com to find the latest episode and run grabber. If grabber doesn't find anything, queue up the search to try again later. Cron jobs will be set to look for each show, and to periodically re-check for queued items.

  4. ep - given a file (or show and series/episode), look up the episode name on epguides.com and rename the file appropriately.

Together this will be a neat little system and save a fair bit of manual work—which is a fundamental goal of computer science ("What can be efficiently automated?").

Update: The patch was committed in April 2010, six months after it was provided.

Books finished: Glenn Beck's Common Sense.