Friday, February 15, 2013

ReadyNAS NV+ v2 Transmission BT with flexget

This guide will cover the steps that I followed to get the Transmission BitTorrent client installed and working with my RSS feeder on a NetGear ReadyNAS NV+ v2 (ARM) I did all of this with RAIDiator 5.3.7 (the OS version)

1. Install the Root SSH Access plugin
http://www.readynas.com/?p=4203
To install plugins on the ReadyNAS
1) Download the .bin file
2) Navigate to the ReadyNAS configuration dashboard (https://ReadyNAS_IP) Select Configure from the header bar.
3) Navigate to the Add-ons section of the configuration dashboard (If you don't see it click on the double arrow (>>)
4) Click on the Add Add-on button (top right below Dashboard)
5) Browse to the bin file and Upload it.

2. Grab the Free Transmission plugin:
http://www.sergeysurba.com/projects/transmission
Install it the same wasy as the Root SSH plugin above.

3. Configure Transimission.
The transmission settings can be set via the webgui, for the most part. However some items can only be configured via the ssh connection, settings file is /c/transmission/settings.json
Information about the configuration variables: https://trac.transmissionbt.com/wiki/ConfigFiles

Example of my configuration
root@NAS:~# cat /c/transmission/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": "0.0.0.0",
    "bind-address-ipv6": "::",
    "blocklist-enabled": true,
    "blocklist-url": "http://list.iblocklist.com/?list=bt_level1&fileformat=p2p",
    "cache-size-mb": 2,
    "dht-enabled": true,
    "download-dir": "/c/media/Torrents",
    "download-queue-enabled": true,
    "download-queue-size": 5,
    "encryption": 2,
    "idle-seeding-limit": 30,
    "idle-seeding-limit-enabled": false,
    "incomplete-dir": "/c/transmission/incomplete",
    "incomplete-dir-enabled": false,
    "lpd-enabled": false,
    "message-level": 2,
    "peer-congestion-algorithm": "",
    "peer-limit-global": 240,
    "peer-limit-per-torrent": 60,
    "peer-port": 15000,
    "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": true,
    "preallocation": 1,
    "prefetch-enabled": 0,
    "queue-stalled-enabled": true,
    "queue-stalled-minutes": 30,
    "ratio-limit": 2.0,
    "ratio-limit-enabled": true,
    "rename-partial-files": true,
    "rpc-authentication-required": false,
    "rpc-bind-address": "0.0.0.0",
    "rpc-enabled": true,
    "rpc-password": "password",
    "rpc-port": 9091,
    "rpc-url": "/transmission/",
    "rpc-username": "username",
    "rpc-whitelist": "*",
    "rpc-whitelist-enabled": false,
    "scrape-paused-torrents-enabled": true,
    "script-torrent-done-enabled": false,
    "script-torrent-done-filename": "",
    "seed-queue-enabled": false,
    "seed-queue-size": 10,
    "speed-limit-down": 100,
    "speed-limit-down-enabled": false,
    "speed-limit-up": 50,
    "speed-limit-up-enabled": true,
    "start-added-torrents": true,
    "trash-original-torrent-files": false,
    "umask": 0,
    "upload-slots-per-torrent": 14,
    "utp-enabled": true
}

To reload the configuration you must stop and re-start the Add-on. This can be accomplished by navigating to the Installed Add-on page, clicking on the name of the Add-on. Unchecking the enabled box, saving, then checking it again, and saving.

For easy torrent control I recommend flexget and the transmission-rpc plugin.
4. How to install flexget and the transmission-rpc plugin. Follow the guide for Linux here:
http://flexget.com/wiki/InstallWizard/Linux/Environment
1) Install python and python-pip
root@NAS:~# apt-get update
root@NAS:~# apt-get install python python-pip

2) check that the python installed is 2.6/2.7
root@NAS:~# python -V
Python 2.6.6

3) Install FlexGet
root@NAS:~# pip install flexget

4) Install the FlexGet transmission-rpc plugin
root@NAS:~# pip install transmissionrpc

6. Configure FlexGet: http://flexget.com/wiki/Configuration
Example of my configuration (simple because I have a webserver do the real filtering for me)
root@NAS:~# cat .flexget/config.yml
presets:
  tv:
    all_series: yes
    set:
      path: /c/media/Torrents
    transmission:
      host: localhost
      port: 9091
      username: username
      password: password

tasks:

  showRSS:
    rss: http://showrss.karmorra.info/rss.php?user_id=getYourOwn&hd=null&proper=null
    preset: tv

It is recommended to use a symbolic link to place the configuration files into the RAID area (/c)
e.g.
lrwxrwxrwx  1 root  root    11 2013-02-12 18:45 .flexget -> /c/flexget/
To create this link do the following
root@NAS:~# cd ~
root@NAS:~# mkdir /c/flexget
root@NAS:~# ln -s /c/flexget/ .flexget

7. Test that FlexGet works, and doesn't show any errors
root@NAS:~# flexget --test
I recommend using this test action anytime you make changes just to be assured that the configuration is still valid.

7. Schedule FlexGet to run following this guide:
http://flexget.com/wiki/InstallWizard/Linux/Environment/FlexGet/Scheduling
root@NAS:~# contab -e
insert and paste:
@hourly /usr/local/bin/flexget --cron
Or the following equivalent expression
0 * * * * /usr/local/bin/flexget --cron
In cron the values are as follows
min hour day month day-of-week
If you set divisions it runs when there is a zero remainder or you can think of it as every multiple of the divisor. e.g. */10 = 0,10,20,30... or */2 = 0,2,4,6,8...