tweak pause/resume

This commit is contained in:
Marcos Pinto 2007-12-29 01:39:58 +00:00
parent eeb2c26002
commit ea7fdc3bc1

View File

@ -758,19 +758,23 @@ Space:") + " " + nice_free)
deluge_core.scrape_tracker(unique_ID) deluge_core.scrape_tracker(unique_ID)
def pause(self, unique_ID): def pause(self, unique_ID):
try: state = self.get_torrent_state(unique_ID)
deluge_core.pause(unique_ID) if not state["is_paused"]:
except: try:
print "pause failed\n" deluge_core.pause(unique_ID)
except:
print "pause failed\n"
def resume(self, unique_ID): def resume(self, unique_ID):
try: state = self.get_torrent_state(unique_ID)
deluge_core.resume(unique_ID) if state["is_paused"]:
# We have to re-apply per torrent settings after resume. This has to try:
# be done until ticket #118 in libtorrent is fixed. deluge_core.resume(unique_ID)
self.apply_prefs_per_torrent(unique_ID) # We have to re-apply per torrent settings after resume. This has to
except: # be done until ticket #118 in libtorrent is fixed.
print "pause failed\n" self.apply_prefs_per_torrent(unique_ID)
except:
print "pause failed\n"
def pause_all(self): def pause_all(self):
if self.config.get('max_active_torrents') != 0: if self.config.get('max_active_torrents') != 0:
@ -884,7 +888,6 @@ Space:") + " " + nice_free)
except DelugeError, e: except DelugeError, e:
del self.state.torrents[torrent] del self.state.torrents[torrent]
raise e raise e
ret = unique_ID ret = unique_ID
self.unique_IDs[unique_ID] = torrent self.unique_IDs[unique_ID] = torrent
self.state.torrents[torrent] = unique_ID self.state.torrents[torrent] = unique_ID