Last active
April 21, 2016 15:29
-
-
Save yamatt/2cd0a674d4c0883ee207757ad6a97d82 to your computer and use it in GitHub Desktop.
Get details out of Deluge using the RPC API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A really hacked down version of http://dev.deluge-torrent.org/wiki/Development/1.3/UIClient | |
# Writen to hook in to a different, syncro, script | |
from deluge.ui.client import client | |
import json | |
# Import reactor for our mainloop | |
from twisted.internet import reactor | |
d = client.connect() | |
def on_connect_success(result): | |
def on_get_status(value): | |
print json.dumps(value) | |
# Disconnect from the daemon once we've got what we needed | |
client.disconnect() | |
# Stop the twisted main loop and exit | |
reactor.stop() | |
# uses some python magic | |
# list of commands available at https://deluge.readthedocs.org/en/develop/core/rpc.html#remote-api | |
# list of statuses available at http://www.rasterbar.com/products/libtorrent/manual.html#status | |
client.core.get_session_status(["payload_upload_rate", "payload_download_rate"]).addCallback(on_get_status) | |
d.addCallback(on_connect_success) | |
reactor.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment