Python rTorrent proxy class
Since I started using rTorrent I’ve been interested in the XMLRPC API so I wrote a python wrapper around the API. I’ve been using it for a while and I’m finally getting around to posting it. It’s mostly passive so I can retrieve info from running transfers, but start, stop, and load commands are there, and you can set the custom values on torrents too. Here is a simple example with rTorrent running on 192.168.1.200:
client = RtorrentProxy(“http://192.168.1.200″)
client.updateTransfers()
for t in client.transfers:
print “%s down: %d up: %d” %(t['name'], t['down_rate'], t['up_rate'])
It’s that simple. Hopefully someone else will find this useful. I was thinking of using it to create an XBMC script to provide some control of rTorrent, but I’ve been busy and may not get around to it.
This should not be confused with this script which works on a slightly different concept. My script sends messages over HTTP and needs a webserver running on the rTorrent host (see my wTorrent setup guide) and encapsulates a bunch of XMLRPC commands so you can automatically retrieve information on individual transfers. The other script takes the XMLRPC commands and then sends them directly as SCGI messages so no webserver is necessary, but each command has to be sent individuall. One good idea would be to combine both scripts, so HTTP isn’t needed, but everything in encapsulated in classes. Let me know if you do anything cool with it.
DOWNLOAD
UPDATE: This code is now on GitHub.
9 Comments