Easy remote torrent queuing with trasmission, zenity, and a dab of glue

Here is just a dab of glue that takes two very cool projects, Transmission and Zenity, and makes something very usable. Open a text editor as the root user (gksu gedit) and copy and paste this script:


#!/usr/bin/env bash

targethost=$(zenity –list –title “Assign host to download torrent” \
–radiolist –column ” ” –column “Host Name” \
TRUE localhost \
FALSE YOURSERVER) || exit

# Special case for localhost so it will still work if transmission is
# not already running
if [ “${targethost}” == “localhost” ]; then
transmission “$1” &
else
# TODO: Start transmision on the remote host if it is not already
# running
transmission-remote ${targethost} -a “$1”
fi


Just replace YOURSERVER with the name of the computer running transmission. Save the script to /usr/local/bin/add-remote-torrent (or whatever you want to name it) and give it execute permssions (sudo chmod +x /usr/local/bin/add-remote-torrent) For help setting up the transmission daemon the Transmission wiki has some well written guides, particulary the one on running Transmission on a headless machine.

Also, note that this script requires Transmission 1.50 or later, which supports adding torrents by URL. Ubuntu 9.04 and newer have this by default. Users of older releases need to add the official Transmission repository. From System -> Administration -> Software Sources, add the following APT line:

deb http://ppa.launchpad.net/transmissionbt/ubuntu intrepid main

Then add the authentication key so that the software repository is recognized as a “Trusted Software Provider”

sudo apt-key adv –recv-keys –keyserver keyserver.ubuntu.com \
0xa37da909ae70535824d82620976b5901365c5ca1

Regardless of what version of Ubuntu you are running, you will need to explicitly install the Command Line Interface version of Transmission (transmission-cli) :

sudo apt-get install transmission-cli

Finally, go to your web browsers setting/preferences page and associate BitTorrent files (MIME type “application/x-bittorrent“) with /usr/local/bin/add-remote-torrent. In Firefox this setting is located at Edit->Preferences->Applications. Now when ever you click a torrent link you will have the option of downloading the torrent on your own computer or on another computer.

This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *