The Ultimate DNS-323 Setup: Part 3 – Transmission Installation & Configuration
Installation of Transmission BitTorrent Client
From your desktop computer, visit http://www.transmissionbt.com/download.php. You are not looking for an official package; you are looking for the source code. Right click on the bz2 version and click ‘Copy Link Location’. SSH to your DNS-323 and using an unprivileged account, use wget to save the source code on the device (anywhere).
Example: wget http://download.transmissionbt.com/files/transmission-2.04.tar.bz2
Extract the source code: tar -jxvf transmission-2.04.tar.bz2
Change dir to the source and build the program:
cd transmission-2.04
./configure –enable-daemon
make
As root or by using sudo:
make install
Transmission should now be successfully installed.
Configuring Transmission for Remote Control
To configure Transmission we will first launch it so it will create a default configuration. This includes a dirctory to store settings, torrent resume files, etc.
As a non-root user:
transmission-daemon –g /mnt/HD_a2/Volume_1/.transmission-daemon
Leave Transmission running for half a minute so it has time to start-up and create the files. To shutdown Transmission, from the command line:
pidof transmission-daemon | xargs kill
Or if it’s easier to remember, use two commands:
pidof transmission-daemon
kill <number from pidof command>
Now we can edit the default Transmission configuration. It is located in/mnt/HD_a2/Volume_1/.transmission-daemon/settings.json (or Volume_0 depending on which HDD bay your using)
You can view the configuration options available fromhttp://trac.transmissionbt.com/wiki/ConfigurationParameters. The options we are primarily interested in are those that will enable remote operation of Transmission.
In settings.json add/modify the following:
“rpc-enabled”: true,
“rpc-bind-address”: “0.0.0.0″,
“rpc-port”: 9091,
“rpc-authentication-required”: false,
“rpc-username”: “”,
“rpc-password”: “”,
“rpc-whitelist-enabled”: true,
“rpc-whitelist”: “127.0.0.1,192.168.*.*”,
The configuration above does not require a username and password but clients may only connect from a local network. To be able to connect and control your torrents from an internet connection, add a * to the whitelist, a username and password and you must port forward port 9091 on your router to forward to the IP of you DNS-323. If you add a password it will be encrypted in the settings file the next time Transmission is opened.
Configuring Transmission to automatically download Torrents from a watch directory
Transmission has a built in feature (finally, it required a script before) to automatically add .torrent files to the Download queue when they are saved to a specific ‘watched directory’. This will allow you to download a .torrent file from your desktop web browser, save it to the watched folder and forget about it! Transmission will add the Torrent and start the download. These are the settings you need:
“watch-dir”: “/mnt/HD_b2/TorrentWatch”,
“watch-dir-enabled”: true
Make sure you create the directory and that it is readable by the user you run Transmission as.
After you have added these settings to settings.json, save the file and start Transmission.
transmission-daemon –g /mnt/HD_a2/Volume_1/.transmission-daemon
You can now save .torrent files directly to the TorrentWatch folder and Transmission will soon after start downloading them. For convenience, you may find setting up a Firefox plugin like FavLoc useful which allows you to select the download location without having to browse through multiple directories. Find it at https://addons.mozilla.org/en-US/firefox/addon/2140. I set this up for my wife and it works great.
Perform mass extraction of downloaded RAR archives (Experimental)
Just recently I spent a few hours and started to work on a script to automatically extract all my torrent downloads. Extraction on the DNS-323 is painfully slow due to its slow processor speed. Extracting many large files (TV shows, movies) manually is a long and boring process. I have made it one step simpler (and will continue to improve the process as time permits).
You may find the project page and monitor updates at http://bitbucket.org/markstahler/auto-extract-python/. The latest version of the script can always be found http://bitbucket.org/markstahler/auto-extract-python/src/tip/auto-extract.py.
Currently, the script takes one argument, a directory which contains archives you wish to extract. The script will recursively search for any .rar archives and extract them one at a time until they are all extracted. Each directory that contains an archive (only one archive per directory is supported) is marked with a hidden file named .unrared. This file will cause the script to ignore the archive within if that specific folder is scanned again. This means that you can safely run this script, pointing it to your main download directory whenever your downloads are fully complete. It will extract your downloads and you are able to move the extracted contents (.avi, .mkv or whatever) wherever you wish and the script will not re-extract them. This allows you to see the original downloaded files as long as you wish.
Sample usage:
python auto-extract.py /mnt/HD_a2/Volume_1/downloads
This will recurse my downloads directory unextracting every archive found. Default behavior is to overwrite files if a .unrared file is not present. You can safely run this on your downloads directory but be warned, it may take a very long time depending on what type of files you have. The script took several hours to complete on my DNS-323 extracting many seasons of TV shows in Xvid format.