Daniel 'MaTachi' Jonsson

Tag Archives: Torrent

Guide to Make Your Computer Automatically Start and Download Torrents on Linux

Today I managed to install and configure software to make my computer automatically start and download torrents. So now my computer will by itself download episodes from series I have specified as soon as they are released. What you basically need (for my solution) is the torrent client Deluge, the application FlexGet and a RSS feed where the torrents are indexed.

Hereunder follow descriptions of what you have to do to get this working (on Arch Linux with Gnome, but most of the steps should work on any distribution. However some commands may differ and such).

Deluge

  1. First, download Deluge from your Linux distribution’s repository, if you don’t already have it installed. On Arch Linux, type the following in the terminal: sudo pacman -Sy deluge
  2. Open the Preferences window under the Edit menu in Deluge. Then navigate to the Interface tab and make sure that Classic Mode isn’t enabled, which I think it’s by default. You have to disable Classic Mode to be able to run the Deluge daemon, which is Deluge without the GUI, in the background.
  3. Next time you start Deluge (I think) it will ask you to start the daemon to make Deluge able to run. Under Edit > Connection Manager in Deluge you can reopen this window.
  4. Then you have to reopen the Preferences window, and under the Downloads tab choose where the torrents (the downloaded content) should be downloaded to.
  5. You can also start the daemon by typing deluged in the terminal. More information about the daemon can be found here: http://dev.deluge-torrent.org/wiki/Faq#Daemon. To see if it’s running, type ps -A | grep deluged in the terminal.

FlexGet

  1. Download and install FlexGet. There are installation instructions in their Wiki: http://flexget.com/wiki. However, if you are on Arch and have a wrapper for pacman and the AUR installed, like Yaourt, type the following in the terminal: yaourt -Sy flexget. (On Arch you probably will need to do some button smashing to install all dependences, since many of them can be found in the AUR too.)
  2. When you have installed FlexGet, create the folder .flexget in your home folder and in it create a file called config.yml. Now you should read a bit on FlexGet’s wiki to learn how you should construct the config file. Especially read the Configuration page. Here is how (a part of) my config file looks like:
    feeds:
      tokyotosho:
        rss: http://www.tokyotosho.info/rss.php?filter=1&entries=450
        series:
          - Fate/Zero
        deluge: yes

    Note the last line: deluge: yes. It’s necessary for making Deluge start the torrents. Also note that you have to specify a RSS-feed where FlexGet should look for new torrents to download.

  3. Now FlexGet should be able to check the RSS feed(s), find the series/content you want to download and make Deluge download them. To test run FlexGet, run flexget –test in the terminal. Of course you can run flexget –help to find more possible commands. But to do a regular check in the RSS feeds, download, and all that stuff, just run flexget. Note that you don’t have to be running Deluge to download the torrents, only deluged is needed.

Start deluged with Gnome

  1. Open a terminal and run gnome-session-properties if you are on Gnome. In the window that pops up you should add an additional startup program – in this case deluged. Just type that in both the Name field and the Command field. If you are using another desktop environment you sadly have to figure out this step by yourself (Google).

Make FlexGet run once every hour automatically

FlexGet only checks the RSS feeds when you run flexget in the terminal. So what we want to do is to schedule the computer to run it once every hour.

  1. Start with adding the following two lines to the .bashrc file in your home folder:
    EDITOR=nano
    export EDITOR

    This will make the next terminal application use the text editor nano instead of whatever alien editor it uses by default. :)

  2. Close all terminal windows and open a new one to apply the change.
  3. Run crontab -e in the terminal.
  4. Add 0 * * * * flexget to the file, and then save and close it with Ctrl + Shift + X. You can find more schedule options here: https://wiki.archlinux.org/index.php/Crontab. Please don’t make it run once every minute or something crazy like that, since that would use a lot of the server’s bandwidth where your RSS feed is hosted.
  5. To see everything you have scheduled, type crontab -l.

Done!

Now your computer should be able to automatically download torrents for you. I hope you found this guide helpful. If you have any wonders or problems, please leave a comment below, and maybe I can help you get it sorted out.