Page 1 of 2
Request: Command line controls
Posted: Sun Sep 02, 2007 8:41 pm
by Juewy
Hi all
I just installed deluge and its going great

but I was wondering, I do a lot of work on a different pc and leave this one on all the time for various things and i manage it remotely, can you add command line options to pause all the downloads and resume them that way i only have to run deluge --pause-transfers remotely sort of thing?
I know it sounds lazy but it saves me walking up the stairs every time i want to use the net
Keep up the fab work!
Juewy
Re: Request: Command line controls
Posted: Thu Sep 06, 2007 10:31 am
by Keiji
I think it would definitely be useful if you could run a terminal command to show the statistics of torrents and also manage the torrents (such as pause/resume, update tracker, add, remove and clear finished), because I also frequently use other computers, and if that feature existed, I could easily use ssh to do that.
Re: Request: Command line controls
Posted: Thu Sep 06, 2007 5:12 pm
by renier
I am resantly writing such a Plugin that opens a Telnet Server interface, to remotly (mainly used local) connect to deluge.
Here is what i got so far. Its NOT finished but its easy to add new command methods to it.
Add a python method that end with Command to the RequestHandler thats all.
Re: Request: Command line controls
Posted: Sun Sep 09, 2007 7:50 pm
by Juewy
Its looking good

if only i knew python

it looks easy enough so I'll try and add some more bits to it when i get chance, can you point me in the right direction of how to find out what i need to type for the deluge stuff, i dont know how to word it exactly but you use self.server.core.unique_IDs for the torrent list command, im guessing its the same as java classes but how do i find out what i can use eg self.server.core.stop_all sort of thing.
Hope that makes a bit of sense
EDIT: I just upgraded deluge to 0.5.5 and when i have this plugin on it goes to 100% cpu usage

Re: Request: Command line controls
Posted: Mon Sep 10, 2007 7:55 pm
by renier
For the 100% CPU
Edit the telnetserver.py file and remove the 'else:' in line 48. Put the next line (sleep) in front of the if.
It should look like:
Code: Select all
while not self.stopthread.isSet():
readySocket = select.select([self.socket], [], [self.socket], 0)
if readySocket[0] or readySocket[2] :
if threading.activeCount() < self.threadLimit:
self.handle_request()
time.sleep(0.5)
print 'server stopped'
For the self.server.core you can call every method (def) on the core you like. just take a look into the core.py file to see whats there.
Re: Request: Command line controls
Posted: Mon Sep 10, 2007 8:43 pm
by renier
Here is an updated Version with preference dialog to setuo host and port.
The issues from above are also fixed.
Re: Request: Command line controls
Posted: Wed Sep 12, 2007 10:07 am
by Juewy
I should of thought about looking for a core.py file, so if i used self.server.common i could use any function in common.py?
I tried adding this to telnetserver.py after the download command:
Code: Select all
def pauseallCommand(self, ignored):
"Pause all torrents."
self.privateMessage('Pausing all torrents.')
self.server.core.pause_all()
But when i type help into the telnet server the pauseall command doesn't appear and it doesnt work when i type pauseall, any ideas?
Thx
Re: Request: Command line controls
Posted: Wed Sep 12, 2007 7:48 pm
by renier
1.) No you can not just user all other classes (files) from deluge by just typing self.server.XYZ only core is there.
2.) depend where you put this method. You have to add it into to the RequestHandler class in telnetserver.py
best is you add it where the helpCommand and all other methods are.
I tried your method and it worked for me.
Re: Request: Command line controls
Posted: Thu Sep 13, 2007 9:59 am
by Juewy
This is very strange, i have tried adding my method into telnetserver.py between prompt and helpCommand, just below helpCommand and in between most of the other methods with no success, the only thing i have changed from what you posted is the server is 127.0.0.1 instead of localhost since localhost gave the error "Server not startet: (99, 'Cannot assign requested address')" ... any ideas?
Also does it take about 20-30 seconds to connect to the telnet server, im guessing its just telnet but im just wondering
Re: Request: Command line controls
Posted: Fri Sep 14, 2007 7:55 pm
by renier
Don't know about your method worked well.
You have to reinstall deluge 'sudo make install' so the script copies all needed files in the right dir.