Code: Select all
# Import the client module
from deluge.ui.client import client
# Import the reactor module from Twisted - this is for our mainloop
from twisted.internet import reactor
from twisted.internet import defer
# Set up the logger to print out errors
from deluge.log import setupLogger
syslog.syslog('deluge test: the script started running')
# Connect to a daemon running on the localhost
# We get a Deferred object from this method and we use this to know if and when
# the connection succeeded or failed.
d = client.connect()
# Torrent ID is passed from deluge execute plugin
torrent_id = sys.argv
# We create a callback function to be called upon a successful connection
#print "Connection was successful!"
# We add the callback to the Deferred object we got from connect()
# We create another callback function to be called when an error is encountered
print "Connection failed!"
print "result:", result
# We add the callback (in this case it's an errback, for error)
# Run the twisted main loop to make everything go
Any help is appreciated!