Dabbling with torrents

Ok. This probably doesn’t belong on a work related blog, but I have nowhere else to publish the stuff I do at home (for fun or otherwise), so here’s a post about getting FlexGet to cooperate with a local Transmission daemon in Mac OS X. I use this setup to automate my downloads of TV shows (yes I tend to pay for them once out on Blu Ray so don’t get all uppity about it, I’m not about to go into a legal debate but I consider this a somewhat grey area). Please note that these steps work on 10.6 and 10.7 (I suppose 10.8 should be fine as well but I haven’t tried it yet).

First off, install Transmission, whichever version works for you. You can install the GUI one and it’ll work just fine.

Next, install FlexGet from terminal (or SSH to your Mac if that’s your cuppa):

sudo easy_install flexget

Next you need to install the transmission rpc plugin:

sudo easy_install transmissionrpc

There. FlexGet is installed, but won’t start automatically. You need to create a launch agent first. First, find out where FlexGet installed itself by typing:

which flexget

This will tell you the path to FlexGet (most commonly /usr/local/bin/flexget).

Create the file /Users/[USERNAME]/Library/LaunchAgents/com.flexget.plist and paste the following code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>com.flexget</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/bin/flexget</string>
		<string>--cron</string>
	</array>
	<key>Nice</key>
	<integer>1</integer>
	<key>StartInterval</key>
	<integer>900</integer>
	<key>RunAtLoad</key>
	<true/>
</dict>
</plist>

Change the path to reflect the response from which flexget if needed.

Next, run the following command:

launchctl load -w /Users/[USERNAME]/Library/LaunchAgents/com.flexget.plist

Now you need to add a config. If there’s no ~/.flexget directory yet, create it and create the file config.yml in it.

Now this is where the power of FlexGet and YAML come in to play. Keep in mind that the data structure hierarchy in YAML is maintained by outline indentation, so the proper ammount of whitespaces is imperative for this to work. There’s a lot of things you can do with YAML and the various plugins included in FlexGet and I won’t get into a lot of it. For more stuff it can do for your torrenting, check the links at the bottom of the post.

Anyway. The most imperative part is the connection to your Transmission RPC, which can be done with the following:

This line should be indented 4 spaces and align with the plugin statements. I’ll paste an example config.yml further down.

The .netrc file contains login details to your Transmission RPC. Make sure you enable remote access and authentication in the Transmission GUI first:

Then create the .netrc file in your ~/ directory and add login details like this in that file:

Be sure to chmod the file to prevent unauthorized access afterwards:

chmod 600 ~/.netrc

Ok. So here’s a basic config.yml to get you started:


So what does all this do?

presets: will let you define the preset, which you can then attach to a tracker feed (you can create different presets for different trackers, or use multiple trackers for the same preset, whichever you prefer. FlexGet is immensly powerful and this example is very basic).

tv: is just the name I chose for this preset.

series: invokes the series plugin.

settings: well.. duh. Preset settings. 🙂

720p: a settings group I use. I use a 2007 Mac Mini for playback and it doesn’t have the horsepower for 1080p.

propers: will look for and download propers and repacks that arrive within a defined time from the initial release.

quality: various quality settings. I only want 720p HDTV releases. !webdl and !webrip will reject releases that match.

720p: call the settings group and apply settings to all the downloads I request.

– name of show: Well. What do you like? The path below can be omitted if you want to move stuff around manually. I use it to have Transmission move the show into it’s proper place after download so my HTPC will see it, and still keep seeding it.

transmission: Nothing special here. This is just the transmission rpc call block.

tasks: This used to be named feeds. Add your trackers, priorities and RSS feeds with download links here (use feeds without cookies).

The links below contain way more detailed descriptions of everything you can use in your config.yml. Have a look there if you need help and ideas.

Ok. That’s pretty much it. Your torrenting should take care of itself pretty much now. I’ve not had to bother with it for ages, and Plex which I use as a HTPC player will automatically download subtitles from opensubtitles.org. Everything is as automated as I could ever hope for 🙂

And now: LINKS!
http://en.wikipedia.org/wiki/YAML – For those interested in reading about YAML
http://flexget.com – The best RSS downloader imaginable. And so much more!
http://flexget.com/wiki/Plugins/series – Intelligent filter for TV-series.
http://flexget.com/wiki/Cookbook – The cookbook, with lots of config suggestions, and some really powerful scripts.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s