mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-16 05:17:31 +00:00
Two new commands 'halt' and 'connect'.
This commit is contained in:
parent
ca3f08690e
commit
885ca2c899
@ -268,6 +268,35 @@ class CommandRemove(Command):
|
|||||||
def help(self):
|
def help(self):
|
||||||
print "Remove a torrent"
|
print "Remove a torrent"
|
||||||
|
|
||||||
|
class CommandHalt(Command):
|
||||||
|
def execute(self, cmd):
|
||||||
|
client.shutdown()
|
||||||
|
|
||||||
|
def help(self):
|
||||||
|
print "Shutdown the deluge server."
|
||||||
|
|
||||||
|
class CommandConnect(Command):
|
||||||
|
def execute(self, cmd):
|
||||||
|
host = 'localhost'
|
||||||
|
port = 58846
|
||||||
|
if len(cmd) > 1:
|
||||||
|
host = cmd[1]
|
||||||
|
if len(cmd) > 2:
|
||||||
|
port = int(cmd[2])
|
||||||
|
|
||||||
|
if host[:7] != "http://":
|
||||||
|
host = "http://" + host
|
||||||
|
|
||||||
|
client.set_core_uri("%s:%d" % (host, port))
|
||||||
|
|
||||||
|
def usage(self):
|
||||||
|
print "Usage: connect [<host> [<port>]]"
|
||||||
|
print " 'localhost' is the default server. 58846 is the default port."
|
||||||
|
print ""
|
||||||
|
|
||||||
|
def help(self):
|
||||||
|
print "Connect to a new deluge server."
|
||||||
|
|
||||||
commands = {
|
commands = {
|
||||||
'add' : CommandAdd(),
|
'add' : CommandAdd(),
|
||||||
'configs' : CommandConfig(),
|
'configs' : CommandConfig(),
|
||||||
@ -279,6 +308,8 @@ commands = {
|
|||||||
'resume' : CommandResume(),
|
'resume' : CommandResume(),
|
||||||
'rm' : CommandRemove(),
|
'rm' : CommandRemove(),
|
||||||
'del' : CommandRemove(),
|
'del' : CommandRemove(),
|
||||||
|
'halt' : CommandHalt(),
|
||||||
|
'connect' : CommandConnect(),
|
||||||
}
|
}
|
||||||
|
|
||||||
logging.disable(logging.ERROR)
|
logging.disable(logging.ERROR)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user