
#Deluge torrent python password#
Specify a dictionary of host, port(integer), username, password
#Deluge torrent python how to#
get_torrents_status (, info_wanted =, action = ( lambda tid, tinfo : 'l' ), interactive = True ): """ Get all torrents and filter themĬonnection_data - How to connect to the deluged daemon. addCallback ( printReport ) def on_session_state ( result ): client. addCallbacks ( printSuccess, printError, callbackArgs = ( True, successmsg ), errbackArgs = ( errormsg ))) elif res = 'l' : printSuccess ( None, False, "%s : Listing (doing nothing)" % ( torrent_id, torrent_info )) elif res = '' : pass else : printError ( "%s : Unknown function response '%s'" % ( torrent_id, torrent_info, res )) except Exception as inst : printError ( "%s : Exception %s" % ( torrent_id, torrent_info, inst )) defer. addCallbacks ( printSuccess, printError, callbackArgs = ( True, successmsg ), errbackArgs = ( errormsg ))) elif res = 'D' : successmsg = "%s : Deleted WITH DATA" % ( torrent_id, torrent_info ) errormsg = "%s : Error deleting WITH DATA" % ( torrent_id, torrent_info ) tlist. items (): try : res = torrentAction ( torrent_id, torrent_info ) if res = 'd' : successmsg = "%s : Deleted without data" % ( torrent_id, torrent_info ) errormsg = "%s : Error deleting without data" % ( torrent_id, torrent_info ) tlist. stop () def printReport ( rresult ): printSuccess ( None, True, "Finished" ) endSession ( None ) def on_torrents_status ( torrents ): tlist = for torrent_id, torrent_info in torrents. disconnect () printSuccess ( None, False, "Client disconnected." ) reactor.

# filter_torrents(connection_data,torrent_info_wanted,action,interactive)įrom deluge.log import LOG as log from deluge.ui.client import client import ponent as component from twisted.internet import reactor, defer import time def printSuccess ( dresult, is_success, smsg ): global is_interactive if is_interactive : if is_success : print "", smsg else : print "", smsg def printError ( emsg ): global is_interactive if is_interactive : print "", emsg def endSession ( esresult ): if esresult : print esresult reactor. # from deluge_framework import filter_torrents
#Deluge torrent python code#
# call filter_torrents from your code like this: Print using the library all torrents containing “linux”: Parameters are detailed in the library itself). All cases assume Deluge libraryįiles (included with Deluge), the library is in “deluge_framework.py”Īnd a local-running daemon (remote instances are obviously fine, and The real action (deletion, for instance) is performed byįirst, some already working use cases. The calling script should only contain the “business logic” - what to do withĮvery torrent. Instead of creating my own (because the DelugeĮvent based and basically annoying), I rewrote that script to give a me To subscribe for updates from the Deluge daemon and many otherĮventually, I found this post, where someone wrote a python script that deletes old torrents.
