From f4bd67c320fc847f36c88275a5f074a493483832 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Tue, 11 Sep 2007 21:55:49 +0000 Subject: [PATCH] pause torrents during blocklist loading and then resume the ones that werent paused to begin with --- plugins/BlocklistImport/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/BlocklistImport/__init__.py b/plugins/BlocklistImport/__init__.py index af409dbe5..8df37e049 100644 --- a/plugins/BlocklistImport/__init__.py +++ b/plugins/BlocklistImport/__init__.py @@ -54,6 +54,12 @@ class BlocklistImport: self.gtkconf = GTKConfig(self) self.gtkprog = GTKProgress(self) 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" @@ -72,7 +78,7 @@ class BlocklistImport: def loadlist(self, fetch=False): self.gtkprog.start() - + # Attempt initial import if fetch: print "Fetching",self.config.get('url') @@ -126,6 +132,10 @@ class BlocklistImport: self.gtkprog.stop() 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): self.gtkconf.start(self.config.get('listtype'),