Install FlexGet on Ubuntu Trusty Tahr 14.04LTS to add RSS functionality to Deluge
The classic way to download files using torrents is as follows:
Go to your favourite torrent site
Search for the torrent you want
Once you've found it, download the torrent file manually
Add the downloaded torrent file to your favourite torrent client
Once it has finished downloading, manually move the file to its final location. (although some torrent clients can do this step for you)
There is a better way, a fully automated way, and that is to use RSS functionality. So for example, let's say you're a NCIS fan and you currently manually download each episode of NCIS as and when it becomes available. Using RSS you can automate this task meaning you can get Deluge to automatically download each episode for you as and when it becomes available. And then, once it's downloaded it will automatically move the file to the location you specify. And this final location can be different for each and every series you download. And you can even get it to send you an email when it's found a new episode to download.
There is a truly excellent tool called FlexGet which can do this, and indeed much more. However, FlexGet can be a little tricky to get up and running and so I've explained how I did it below:
IMPORTANT: Downloading TV shows and the like from the internet can have questionable legality in many countries. So, if you're not familiar with the particular law in your part of the world then let your conscience be your guide as to what you do and do not download!
NOTE: These instructions have been written for Trusty Tahr 14.04LTS, Precise Pangolin 12.04, Maverick Meerkat 10.10, Lucid Lynx 10.04 and Karmic Koala 9.10 and rely on Deluge being installed.
Install Python & pip
First off we need to install Python and pip if they're not installed already. So type or paste the following two commands into a Putty session or directly into the command line of your Ubuntu installation:
sudo apt-get update
sudo apt-get install python python-pip
Download and install FlexGet
We now want to download and install FlexGet itself. This is a LOT easier than it used to be. Now it's just a single command:
sudo pip install flexget
To verify the installation worked properly type:
and it should return the version number. eg. 1.2.201. It will also tell you whether you're on the latest release or not (which we are given we've just installed it!). See NOTE below.
When a new version of FlexGet is released and you want to upgrade to it, simply type the following:
sudo pip install --upgrade flexget
NOTE: At the time of writing there is a bug in the installation which can be solved by issuing the above command. Once you've run it confirm it's working by issuing flexget -V once more.
Create the FlexGet working area
Often scripts and applications are run as the default Ubuntu User. However, I run FlexGet using the "deluge" user. The deluge user is the username the Deluge daemon runs under (assuming of course that you've installed Deluge following my guide). If we don't do so then we will hit permission problems since the two parts of the setup (Deluge and FlexGet) will be creating files and folders using different usernames and thus will be using different file/folder permissions.
So we first need to create the working area which FlexGet will use:
sudo -u deluge mkdir /var/lib/deluge/.flexget
Next we need to add the deluge user as a valid user for the deluge API. So:
sudo -u deluge vim /var/lib/deluge/.config/deluge/auth
This will open a file called auth which lives in the /var/lib/deluge/.config/deluge folder.
There is already one line in this file but we need to insert an extra line. So press the [Insert] key once (to go into "edit" mode) scroll to the end of the row that's alread there and insert a new blank line. Next type or paste the following string into this new blank line:
Now press the [Esc] key once and type the following:
This should save your changes and bring you back to the command line. If you make a mistake editing the file then issue :q! instead of :wq to abort your changes.
Running FlexGet in Daemon Mode
In older versions of FlexGet you'd run FlexGet perioidically using a cron job. Now you can simply run it as a Daemon. So, it'll automatically start when the server boots up and check for updated torrents according to the schedule you set in the configuration file. so, let's do that now.
If you're following my advice about storing configuration files separately then please note that with upstart scripts there has to be a copy stored directly on the Operating System partition. So, instead of linking to it we have to make a copy of it. That's no big deal really since we'll not need to edit the script once it's created.
So, let's create the first script we need by typing the following command:
sudo vim /media/WD40EFRX/RAIDMain/MyScripts/flexget.conf
obviously substituting /media/WD40EFRX/RAIDMain/MyScripts with the location of your script files.
Next, assuming you're using Putty, highlight the following commands, right-click on them and select Copy
#!/bin/bash # Flexget daemon autostart
description "Flexget daemon" author "Kempe"
start on (filesystem and networking) or runlevel  stop on runlevel 
Toggle back to the Putty Session and press the [Insert] key once and add a couple of blank lines by pressing the [Enter] key. Next right click and the lines we've just copied above will be pasted into the file.
Now press the [Esc] key once and type :wq to save and quit out of the script. If you make a mistake editing the file then issue :q! instead of :wq to abort your changes.
Now let's copy it to the location required as part of upstart: