Flexget & Transmission Daemon downloading your torrents for you
Autor: Eduardo Otubo | Publicado: 2012-02-23T00:37:00-02:00


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:



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



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




root@minivader ~ # cat /etc/transmission-daemon/settings.json&nbsp;

{

&nbsp; &nbsp; "alt-speed-down": 50,&nbsp;

&nbsp; &nbsp; "alt-speed-enabled": false,&nbsp;

&nbsp; &nbsp; "alt-speed-time-begin": 540,&nbsp;

&nbsp; &nbsp; "alt-speed-time-day": 127,&nbsp;

&nbsp; &nbsp; "alt-speed-time-enabled": false,&nbsp;

&nbsp; &nbsp; "alt-speed-time-end": 1020,&nbsp;

&nbsp; &nbsp; "alt-speed-up": 50,&nbsp;

&nbsp; &nbsp; "bind-address-ipv4": "0.0.0.0",&nbsp;

&nbsp; &nbsp; "bind-address-ipv6": "::",&nbsp;

&nbsp; &nbsp; "blocklist-enabled": false,&nbsp;

&nbsp; &nbsp; "blocklist-url": "http://www.example.com/blocklist",&nbsp;

&nbsp; &nbsp; "cache-size-mb": 4,&nbsp;

&nbsp; &nbsp; "dht-enabled": true,&nbsp;

&nbsp; &nbsp; "download-dir": "/media/deathstar/torrent",&nbsp;

&nbsp; &nbsp; &nbsp; change this to your destination folder

&nbsp; &nbsp; "download-limit": 100,&nbsp;

&nbsp; &nbsp; "download-limit-enabled": 0,&nbsp;

&nbsp; &nbsp; "encryption": 1,&nbsp;

&nbsp; &nbsp; "idle-seeding-limit": 30,&nbsp;

&nbsp; &nbsp; "idle-seeding-limit-enabled": false,&nbsp;

&nbsp; &nbsp; "incomplete-dir": "/home/otubo/Downloads",&nbsp;

&nbsp; &nbsp; "incomplete-dir-enabled": false,&nbsp;

&nbsp; &nbsp; "lpd-enabled": false,&nbsp;

&nbsp; &nbsp; "max-peers-global": 200,&nbsp;

&nbsp; &nbsp; "message-level": 2,&nbsp;

&nbsp; &nbsp; "peer-congestion-algorithm": "",&nbsp;

&nbsp; &nbsp; "peer-limit-global": 10000,&nbsp;

&nbsp; &nbsp; "peer-limit-per-torrent": 1000,&nbsp;

&nbsp; &nbsp; "peer-port": 51413,&nbsp;

&nbsp; &nbsp; "peer-port-random-high": 65535,&nbsp;

&nbsp; &nbsp; "peer-port-random-low": 49152,&nbsp;

&nbsp; &nbsp; "peer-port-random-on-start": false,&nbsp;

&nbsp; &nbsp; "peer-socket-tos": "default",&nbsp;

&nbsp; &nbsp; "pex-enabled": true,&nbsp;

&nbsp; &nbsp; "port-forwarding-enabled": false,&nbsp;

&nbsp; &nbsp; "preallocation": 1,&nbsp;

&nbsp; &nbsp; "prefetch-enabled": 1,&nbsp;

&nbsp; &nbsp; "ratio-limit": 2,&nbsp;

&nbsp; &nbsp; "ratio-limit-enabled": false,&nbsp;

&nbsp; &nbsp; "rename-partial-files": true,&nbsp;

&nbsp; &nbsp; "rpc-authentication-required": true,&nbsp;

&nbsp; &nbsp; "rpc-bind-address": "0.0.0.0",&nbsp;

&nbsp; &nbsp; "rpc-enabled": true,&nbsp;

&nbsp; &nbsp; "rpc-password": "whatever",&nbsp;

&nbsp; &nbsp; "rpc-port": 9091,&nbsp;

&nbsp; &nbsp; "rpc-url": "/transmission/",&nbsp;

&nbsp; &nbsp; "rpc-username": "otubo",&nbsp;

&nbsp; &nbsp; "rpc-whitelist": "*",&nbsp;

&nbsp; &nbsp; "rpc-whitelist-enabled": true,

&nbsp; &nbsp; &nbsp;enable all the rpc options above (user &amp; password optional) this is important to make flexget talk to transmission AND access transmission daemon web @ http://localhost:9091

&nbsp; &nbsp; "script-torrent-done-enabled": false,&nbsp;

&nbsp; &nbsp; "script-torrent-done-filename": "",&nbsp;

&nbsp; &nbsp; "speed-limit-down": 100,&nbsp;

&nbsp; &nbsp; "speed-limit-down-enabled": false,&nbsp;

&nbsp; &nbsp; "speed-limit-up": 100,&nbsp;

&nbsp; &nbsp; "speed-limit-up-enabled": false,&nbsp;

&nbsp; &nbsp; "start-added-torrents": true,&nbsp;

&nbsp; &nbsp; "trash-original-torrent-files": false,&nbsp;

&nbsp; &nbsp; "umask": 18,&nbsp;

&nbsp; &nbsp; "upload-limit": 100,&nbsp;

&nbsp; &nbsp; "upload-limit-enabled": 0,&nbsp;

&nbsp; &nbsp; "upload-slots-per-torrent": 14,&nbsp;

&nbsp; &nbsp; "utp-enabled": true

}




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



&nbsp; &nbsp; kill -HUP pid



or



&nbsp; &nbsp; invoke-rc.d transmission-daemon reload



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




root@minivader ~ # cat ~/.flexget/config.yml&nbsp;

presets:

&nbsp; global:

&nbsp; &nbsp; transmission:

&nbsp; &nbsp; &nbsp; host: localhost

&nbsp; &nbsp; &nbsp; port: 9091

&nbsp; &nbsp; &nbsp; username: otubo

&nbsp; &nbsp; &nbsp; password: whatever

&nbsp; &nbsp; email:

&nbsp; &nbsp; &nbsp; change your gmail credentials

&nbsp; &nbsp; &nbsp; from: youremail@gmail.com

&nbsp; &nbsp; &nbsp; to:

&nbsp; &nbsp; &nbsp; &nbsp; - youremail@gmail.com

&nbsp; &nbsp; &nbsp; &nbsp; - your_room_mate@gmail.com

&nbsp; &nbsp; &nbsp; smtp_host: smtp.gmail.com

&nbsp; &nbsp; &nbsp; smtp_port: 587

&nbsp; &nbsp; &nbsp; smtp_username: youremail

&nbsp; &nbsp; &nbsp; smtp_password: yourpasswd

&nbsp; &nbsp; &nbsp; smtp_tls: yes

&nbsp; &nbsp; series:

&nbsp; &nbsp; &nbsp; configure as you wish, plain text, human readable :)

&nbsp; &nbsp; &nbsp; - The Big Bang Theory

&nbsp; &nbsp; &nbsp; - House

&nbsp; &nbsp; &nbsp; - Family Guy

&nbsp; &nbsp; &nbsp; - How I Met Your Mother

&nbsp; &nbsp; &nbsp; - The New Girl

&nbsp; &nbsp; &nbsp; - Grey's Anatomy

&nbsp; &nbsp; &nbsp; - Private Practice

&nbsp; &nbsp; &nbsp; - The Secret Circle

&nbsp; &nbsp; &nbsp; - The Vampire Diaries

&nbsp; &nbsp; &nbsp; - Hart of Dixie

&nbsp; &nbsp; &nbsp; - The Walking Dead

&nbsp; &nbsp; &nbsp; - The Good Wife

&nbsp; &nbsp; &nbsp; - Switched at birth

&nbsp; &nbsp; &nbsp; - Once Upon a Time

&nbsp; &nbsp; &nbsp; - True Blood

&nbsp; &nbsp; &nbsp; - Teen Wolf



feeds:

&nbsp; this is where I look for new torrents, you can add yours

&nbsp; btchat-vtv:

&nbsp; &nbsp; rss: http://rss.bt-chat.com/?group=2

&nbsp; btchat-eztv:

&nbsp; &nbsp; rss: http://rss.bt-chat.com/?group=3

&nbsp; btchat:

&nbsp; &nbsp; rss: http://rss.bt-chat.com/?group=1

&nbsp; btchat-verified:

&nbsp; &nbsp; rss: http://rss.bt-chat.com/?group=230

&nbsp; ezrss-latest:

&nbsp; &nbsp; rss: http://www.ezrss.it/feed/




4) Now put your flexget into a cronjob:




&nbsp; &nbsp; root@minivader ~ # crontab -l|grep flexget

&nbsp; &nbsp; @hourly /usr/local/bin/flexget --cron




Now you might want to run:



&nbsp; &nbsp;&nbsp;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:&nbsp;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 :)