Update the null-client to work with the changed 'state' key.

This commit is contained in:
Sadrul Habib Chowdhury 2008-03-05 06:22:28 +00:00
parent f0d52b4fda
commit 6e5da1cae3
1 changed files with 5 additions and 4 deletions

View File

@ -192,15 +192,12 @@ class CommandInfo(Command):
print "Show information about the torrents" print "Show information about the torrents"
def show_info(self, torrent, brief): def show_info(self, torrent, brief):
def show_state(state):
ts = common.TORRENT_STATE
return ts.keys()[ts.values().index(state)]
def _got_torrent_status(state): def _got_torrent_status(state):
print "*** ID:", torrent print "*** ID:", torrent
print "*** Name:", state['name'] print "*** Name:", state['name']
print "*** Path:", state['save_path'] print "*** Path:", state['save_path']
print "*** Completed:", common.fsize(state['total_done']) + "/" + common.fsize(state['total_size']) print "*** Completed:", common.fsize(state['total_done']) + "/" + common.fsize(state['total_size'])
print "*** Status:", show_state(state['state']) print "*** Status:", state['state']
if state['state'] in [3, 4, 5, 6]: if state['state'] in [3, 4, 5, 6]:
print "*** Download Speed:", common.fspeed(state['download_payload_rate']) print "*** Download Speed:", common.fspeed(state['download_payload_rate'])
print "*** Upload Speed:", common.fspeed(state['upload_payload_rate']) print "*** Upload Speed:", common.fspeed(state['upload_payload_rate'])
@ -346,6 +343,10 @@ class NullUI:
print "*** Operation failed. You are not connected to a deluge daemon." print "*** Operation failed. You are not connected to a deluge daemon."
print " Perhaps you want to 'connect' first." print " Perhaps you want to 'connect' first."
print "" print ""
#except deluge.error.InvalidTorrent, e:
# print "*** Operation failed. You tried to perform an operation on a non-existent torrent."
# print " Use the 'info' command for the list of torrents."
# print ""
print "Thanks." print "Thanks."