pause torrents during blocklist loading and then resume the ones that werent paused to begin with

This commit is contained in:
Marcos Pinto 2007-09-11 21:55:49 +00:00
commit f4bd67c320

View file

@ -54,6 +54,12 @@ class BlocklistImport:
self.gtkconf = GTKConfig(self) self.gtkconf = GTKConfig(self)
self.gtkprog = GTKProgress(self) self.gtkprog = GTKProgress(self)
self.nimported = 0 self.nimported = 0
# Stop all torrents
self.paused_or_not = {}
for unique_ID in self.core.unique_IDs:
self.paused_or_not[unique_ID] = self.core.is_user_paused(unique_ID)
if not self.paused_or_not[unique_ID]:
self.core.set_user_pause(unique_ID, True, enforce_queue=False)
self.blockfile = deluge.common.CONFIG_DIR + "/blocklist.cache" self.blockfile = deluge.common.CONFIG_DIR + "/blocklist.cache"
@ -72,7 +78,7 @@ class BlocklistImport:
def loadlist(self, fetch=False): def loadlist(self, fetch=False):
self.gtkprog.start() self.gtkprog.start()
# Attempt initial import # Attempt initial import
if fetch: if fetch:
print "Fetching",self.config.get('url') print "Fetching",self.config.get('url')
@ -126,6 +132,10 @@ class BlocklistImport:
self.gtkprog.stop() self.gtkprog.stop()
self.cancelled = False self.cancelled = False
#restart torrents that werent paused by us
for unique_ID in self.core.unique_IDs:
if not self.paused_or_not[unique_ID]:
self.core.set_user_pause(unique_ID, False, enforce_queue=False)
def configure(self, window): def configure(self, window):
self.gtkconf.start(self.config.get('listtype'), self.gtkconf.start(self.config.get('listtype'),