Here I will show how you can control a remote Transmission torrent client from the command line. Transmission is the standard Ubuntu torrent client. This will mean that instead of following my previous post to download the latest Linux Mint or Ubuntu torrent, you could add it via the command line from a remote ssh session.
In order for this to work you will need to ensure that Transmission has it's "web client" enabled as shown in this screenshot. For security reasons you would not want to open it to the world, so make sure that it is only open to the local machine that it is running on (i.e. 127.0.0.1)
You will also need to install the "transmission-cli" package, using whatever package manager your system uses, in Ubuntu you can do "sudo apt-get install transmission-cli", and make sure Transmission is running, if it isn't then you can start it from the command line as follows:
- clive@dogmatix > transmission-remote -l
- [12:08:22.988] transmission-remote: (http://localhost:9091/transmission/rpc/) Couldn't connect to server
- clive@dogmatix > export DISPLAY=:0
- clive@dogmatix > nohup transmission-gtk >/dev/null 2>&1 &
- [1] 22245
- clive@dogmatix > transmission-remote -l
- ID Done Have ETA Up Down Ratio Status Name
- 1 100% 801 MB Done 0.0 0.0 0.00 Stopped linuxmint-13-cinnamon-dvd-64bit-rc.iso
- Sum: 801 MB 0.0 0.0
- clive@dogmatix >
To add a torrent to Transmission you would do the following (You need to know the url for the torrent file itself)
- clive@dogmatix > transmission-remote -a "http://torrents.linuxmint.com/torrents/linuxmint-14-cinnamon-dvd-64bit-rc.iso.torrent"
- localhost:9091/transmission/rpc/ responded: "success"
- clive@dogmatix > transmission-remote -l
- ID Done Have ETA Up Down Ratio Status Name
- 1 100% 801 MB Done 0.0 0.0 0.00 Stopped linuxmint-13-cinnamon-dvd-64bit-rc.iso
- 2 0% 19.05 MB 1 hrs 0.0 178.0 0.00 Downloading linuxmint-14-cinnamon-dvd-64bit-rc.iso
- Sum: 820.05 MB 0.0 178.0
To stop a torrent do the following (Need to know the torrent number, obtained from "transmission-remote -l")
- clive@dogmatix > transmission-remote -t 2 -S
- localhost:9091/transmission/rpc/ responded: "success"
To remove a torrent (Including the downloaded file(s)):
- clive@dogmatix > transmission-remote -t 2 --remove-and-delete
- localhost:9091/transmission/rpc/ responded: "success"
The following shows all the options available to control the Transmission client:
clive@dogmatix > transmission-remote --help
transmission-remote 2.51 (13280)
A fast and easy BitTorrent client
http://www.transmissionbt.com/
Usage: transmission-remote [host] [options]
transmission-remote [port] [options]
transmission-remote [host:port] [options]
transmission-remote [http(s?)://host:port/transmission/] [options]
See the man page for detailed explanations and many examples.
Options:
-h --help Display this help page and exit
-a --add Add torrent files by filename or URL
-as --alt-speed Use the alternate Limits
-AS --no-alt-speed Don't use the alternate Limits
-asd --alt-speed-downlimit
kB/s)
-asu --alt-speed-uplimit
-asc --alt-speed-scheduler Use the scheduled on/off times
-ASC --no-alt-speed-scheduler Don't use the scheduled on/off times
--alt-speed-time-begin
they're complete
-C --no-incomplete-dir Don't store incomplete torrents in a
different location
-b --debug Print debugging information
-d --downlimit
for the current torrent(s) or
globally
-D --no-downlimit Disable max download speed for the
current torrent(s) or globally
-e --cache
memory cache (in MiB)
-er --encryption-required Encrypt all peer connections
-ep --encryption-preferred Prefer encrypted peer connections
-et --encryption-tolerated Prefer unencrypted peer connections
--exit Tell the transmission session to shut
down
-f --files List the current torrent(s)' files
-g --get
-G --no-get
-i --info Show the current torrent(s)' details
-if --info-files List the current torrent(s)' files
-ip --info-peers List the current torrent(s)' peers
-ic --info-pieces List the current torrent(s)' pieces
-it --info-trackers List the current torrent(s)'
trackers
-si --session-info Show the session's details
-st --session-stats Show the session's statistics
-l --list List all torrents
--move
folder
--find
torrent's data
-m --portmap Enable portmapping via NAT-PMP or
UPnP
-M --no-portmap Disable portmapping
-n --auth
-ne --authenv Set authentication info from the
TR_AUTH environment variable
(user:pw)
-N --netrc
file
--ssl Use SSL when talking to daemon
-o --dht Enable distributed hash tables (DHT)
-O --no-dht Disable distributed hash tables
(DHT)
-p --port
51413)
-pt --port-test Port testing
-P --random-port Random port for incomping peers
-ph --priority-high
-pn --priority-normal
normally
-pl --priority-low
-Bh --bandwidth-high Give this torrent first chance at
available bandwidth
-Bn --bandwidth-normal Give this torrent bandwidth left over
by high priority torrents
-Bl --bandwidth-low Give this torrent bandwidth left over
by high and normal priority torrents
--reannounce Reannounce the current torrent(s)
-r --remove Remove the current torrent(s)
-pr --peers
the current torrent(s) or globally
--remove-and-delete Remove the current torrent(s) and
delete local data
--torrent-done-script
torrent finishes
--no-torrent-done-script Don't run a script when torrents
finish
-sr --seedratio ratio Let the current torrent(s) seed until
a specific ratio
-srd --seedratio-default Let the current torrent(s) use the
global seedratio settings
-SR --no-seedratio Let the current torrent(s) seed
regardless of ratio
-gsr --global-seedratio ratio All torrents, unless overridden by a
per-torrent setting, should seed
until a specific ratio
-GSR --no-global-seedratio All torrents, unless overridden by a
per-torrent setting, should seed
regardless of ratio
-td --tracker-add
-tr --tracker-remove
-s --start Start the current torrent(s)
-S --stop Stop the current torrent(s)
-t --torrent
--start-paused Start added torrents paused
--no-start-paused Start added torrents unpaused
--trash-torrent Delete torrents after adding
--no-trash-torrent Do not delete torrents after adding
-hl --honor-session Make the current torrent(s) honor the
session limits
-HL --no-honor-session Make the current torrent(s) not honor
the session limits
-u --uplimit
the current torrent(s) or globally
-U --no-uplimit Disable max upload speed for the
current torrent(s) or globally
--utp Enable uTP for peer connections
--no-utp Disable uTP for peer connections
-v --verify Verify the current torrent(s)
-V --version Show version number and exit
-w --download-dir
download folder. Otherwise, set the
default download folder
-x --pex Enable peer exchange (PEX)
-X --no-pex Disable peer exchange (PEX)
-y --lpd Enable local peer discovery (LPD)
-Y --no-lpd Disable local peer discovery (LPD)
-pi --peer-info List the current torrent(s)' peers

Thanks, I was looking for something like this.
ReplyDeleteI was thinking of installing torrentflux but did not want to run an apache server, and this is exactly what I was looking for.
Cheers