clutch
is a Python library for controlling Transmission.
clutch
is compatible with both Python2 and Python3.
To install:
pip install transmission-clutch
To use:
>>> from clutch.core import Client
clutch
was designed to be a more lightweight and consistent Transmission
RPC library than what was currently available for Python. Instead of simply
using the keys/fields in the Transmission RPC spec which have a mix of
dashed separated words and mixed case words, clutch
tries to convert all
keys to be more Pythonic: underscore separated words. This conversion is
done so that it is still possible to specify the fields/argument specified in the Transmission RPC spec, but if you do so your mileage may vary (probably want to
avoid it).
clutch
is designed to work with all versions of Transmission, but for
renamed fields before and after Transmission version 1.60 (RPC v5) you
must specify the correct argument names (no automatic renames).
To use clutch
to control a default transmission-daemon
on
localhost
:
>>> client = Client()
>>> client.list()
which produces a list of dictionaries with the torrent information (keys are the fields: client.list_fields), and is synonymous to calling
>>> client.torrent.get(client.list_fields)
To use different connection information:
- complete path
>>> client = Client(address="https://host:port/path")
- default URL, but port change to 8080
>>> client = Client(port=8080)
- default URL, but different host
>>> client = Client(host="github.com")
- default URL, but use a username and password
>>> client = Client(username='username', password='password')
clutch
's RPC methods are namespaced into four sections:
- port_test -- return if transmission port is open.
- blocklist_update -- update block list and return block list size.
- list (
torrent.get
helper) -- list basic torrent info for all torrents.
- move_bottom -- move torrent to bottom of the queue.
- move_down -- move torrent down in the queue.
- move_top -- move torrent to the top of the queue.
- move_up -- move torrent up in the queue.
- close -- shutdown the Transmission daemon.
- get -- get session properties.
- set -- set session properties.
- stats -- get session statistics.
- add -- add a new torrent.
- get -- get torrent properties.
- files (
torrent.get
helper) -- get file information for one or more torrents. - percent_done (
torrent.get
helper) -- get torrent percent done for one or more torrents. - remove -- remove a torrent from transmission and optionally delete the data.
- set -- set torrent properties.
- set_location -- set/move torrent location.