quinta-feira, 23 de fevereiro de 2012

Flexget & Transmission Daemon downloading your torrents for you

  • Do you watch dozens of TV shows and it sucks to download every single one of them?
  • Do you have trouble on finding torrent files?
  • Is it hard to keep track which one has new episodes or not?

Well, your problems are finally over! By the end of this (pretty cool) straight-forward tutorial you'll have an email at your inbox every time there's a new episode to watch. And there's more! Call now and.. Ok, I got it.

Note: I configured this service on my home-based Ubuntu Server running on a Beagle Board - no arch dependent. In other words, if you want a fully automatic service, you might want to install it on a always-on-computer, not your notebook. :)

Ok, cut the crap. Let's do this!

1) Download and install Flexget. Keep cool, it's easy.
2) Before configuring flexget, install transmission-daemon:

    root@minivader ~ # sudo apt-get install transmission-daemon

and edit the configuration file to look like this: (customize the configuration as you wish and erase the comments in red)

root@minivader ~ # cat /etc/transmission-daemon/settings.json 
    "alt-speed-down": 50, 
    "alt-speed-enabled": false, 
    "alt-speed-time-begin": 540, 
    "alt-speed-time-day": 127, 
    "alt-speed-time-enabled": false, 
    "alt-speed-time-end": 1020, 
    "alt-speed-up": 50, 
    "bind-address-ipv4": "", 
    "bind-address-ipv6": "::", 
    "blocklist-enabled": false, 
    "blocklist-url": "http://www.example.com/blocklist", 
    "cache-size-mb": 4, 
    "dht-enabled": true, 
    "download-dir": "/media/deathstar/torrent", 
      change this to your destination folder
    "download-limit": 100, 
    "download-limit-enabled": 0, 
    "encryption": 1, 
    "idle-seeding-limit": 30, 
    "idle-seeding-limit-enabled": false, 
    "incomplete-dir": "/home/otubo/Downloads", 
    "incomplete-dir-enabled": false, 
    "lpd-enabled": false, 
    "max-peers-global": 200, 
    "message-level": 2, 
    "peer-congestion-algorithm": "", 
    "peer-limit-global": 10000, 
    "peer-limit-per-torrent": 1000, 
    "peer-port": 51413, 
    "peer-port-random-high": 65535, 
    "peer-port-random-low": 49152, 
    "peer-port-random-on-start": false, 
    "peer-socket-tos": "default", 
    "pex-enabled": true, 
    "port-forwarding-enabled": false, 
    "preallocation": 1, 
    "prefetch-enabled": 1, 
    "ratio-limit": 2, 
    "ratio-limit-enabled": false, 
    "rename-partial-files": true, 
    "rpc-authentication-required": true, 
    "rpc-bind-address": "", 
    "rpc-enabled": true, 
    "rpc-password": "whatever", 
    "rpc-port": 9091, 
    "rpc-url": "/transmission/", 
    "rpc-username": "otubo", 
    "rpc-whitelist": "*", 
    "rpc-whitelist-enabled": true,
     enable all the rpc options above (user & password optional) this is important to make flexget talk to transmission AND access transmission daemon web @ http://localhost:9091
    "script-torrent-done-enabled": false, 
    "script-torrent-done-filename": "", 
    "speed-limit-down": 100, 
    "speed-limit-down-enabled": false, 
    "speed-limit-up": 100, 
    "speed-limit-up-enabled": false, 
    "start-added-torrents": true, 
    "trash-original-torrent-files": false, 
    "umask": 18, 
    "upload-limit": 100, 
    "upload-limit-enabled": 0, 
    "upload-slots-per-torrent": 14, 
    "utp-enabled": true

Note: Remember NOT to kill transmission-daemon, you need to SIGHUP it in order to reload the configuration. You can either:

    kill -HUP pid


    invoke-rc.d transmission-daemon reload

3) Now configure Flexget to look like this: (customize the configuration as you wish and erase the comments in red)

root@minivader ~ # cat ~/.flexget/config.yml 
      host: localhost
      port: 9091
      username: otubo
      password: whatever
      change your gmail credentials
      from: youremail@gmail.com
        - youremail@gmail.com
        - your_room_mate@gmail.com
      smtp_host: smtp.gmail.com
      smtp_port: 587
      smtp_username: youremail
      smtp_password: yourpasswd
      smtp_tls: yes
      configure as you wish, plain text, human readable :)
      - The Big Bang Theory
      - House
      - Family Guy
      - How I Met Your Mother
      - The New Girl
      - Grey's Anatomy
      - Private Practice
      - The Secret Circle
      - The Vampire Diaries
      - Hart of Dixie
      - The Walking Dead
      - The Good Wife
      - Switched at birth
      - Once Upon a Time
      - True Blood
      - Teen Wolf

  this is where I look for new torrents, you can add yours
    rss: http://rss.bt-chat.com/?group=2
    rss: http://rss.bt-chat.com/?group=3
    rss: http://rss.bt-chat.com/?group=1
    rss: http://rss.bt-chat.com/?group=230
    rss: http://www.ezrss.it/feed/

4) Now put your flexget into a cronjob:

    root@minivader ~ # crontab -l|grep flexget
    @hourly /usr/local/bin/flexget --cron

Now you might want to run:

    root@minivader ~ # flexget -v

and check if everything goes fine. Once everything goes smoothly, DONE! Now you can LITERALLY sit and watch your server download all the content for you :-)

How it works, for those who like to read the post until the end: cron will run flexget hourly. It will read the RSS from the feed you pointed trying to match the TV Show name. If it matches, flexget will send you an email AND perform an RPC to talk to transmission in order to add the torrent file in the queue for download. You can check the progress in the transmission daemon web @ http://localhost:9091

5) Missing points that I leave for you to have some fun:
  • We should tell transmission-daemon to stop seeding at some point (after it finishes, or after it gets to a certain ratio number would be perfect)
  • It would be really cool to download each TV show into a separate directory.
  • AND EVEN COOLER if we could separate the files into Season folders, creating new ones when season changes.
All right, that's it. have fun :)

2 comentários:

Ricardo disse...


Eduardo Otubo disse...
Este comentário foi removido pelo autor.