summaryrefslogtreecommitdiffstats
path: root/module/ThreadManager.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-10-13 15:25:32 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-10-13 15:25:32 +0200
commit43460c40d00819535dfeecfdb80f8a608f2190fd (patch)
tree351518d8db3e5ee12689af4e019d5c3fc90bd212 /module/ThreadManager.py
parentpatches from #392 (diff)
downloadpyload-43460c40d00819535dfeecfdb80f8a608f2190fd.tar.xz
improvement for hook plugins, new internal plugin type
Diffstat (limited to 'module/ThreadManager.py')
-rw-r--r--module/ThreadManager.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/module/ThreadManager.py b/module/ThreadManager.py
index 7b64a2f9a..8937f4a29 100644
--- a/module/ThreadManager.py
+++ b/module/ThreadManager.py
@@ -116,17 +116,19 @@ class ThreadManager:
def setInfoResults(self, rid, result):
self.infoResults[rid].update(result)
- def downloadingIds(self):
- """get a list of the currently downloading pyfile's ids"""
- return [x.active.id for x in self.threads if x.active and isinstance(x.active, PyFile)]
+ def getActiveFiles(self):
+ active = [x.active for x in self.threads if x.active and isinstance(x.active, PyFile)]
+ for t in self.localThreads:
+ active.extend(t.getActiveFiles())
+
+ return active
def processingIds(self):
"""get a id list of all pyfiles processed"""
- return [x.active.id for x in self.threads + self.localThreads if x.active and isinstance(x.active, PyFile)]
+ return [x.id for x in self.getActiveFiles()]
-
def work(self):
"""run all task which have to be done (this is for repetivive call by core)"""
try:
@@ -163,7 +165,7 @@ class ThreadManager:
active = [x.active.plugin.wantReconnect and x.active.plugin.waiting for x in self.threads if x.active]
- if not (active.count(True) > 0 and len(active) == active.count(True)):
+ if not (0 < active.count(True) == len(active)):
return False
if not exists(self.core.config['reconnect']['method']):
@@ -241,7 +243,7 @@ class ThreadManager:
def cleanPycurl(self):
""" make a global curl cleanup (currently ununused) """
- if self.downloadingIds() or self.processingIds():
+ if self.processingIds():
return False
pycurl.global_cleanup()
pycurl.global_init(pycurl.GLOBAL_DEFAULT)