diff options
author | Paul King <devnull@localhost> | 2011-05-16 20:40:25 +0200 |
---|---|---|
committer | Paul King <devnull@localhost> | 2011-05-16 20:40:25 +0200 |
commit | d94868828e60167b2dbb20f39ea4282fd636844e (patch) | |
tree | aa563f6ee730166853555a8fc9b3735c260d09a6 /module/ThreadManager.py | |
parent | Several Crypters and Hosters fixes, improvements, python2.5 issues... (diff) | |
download | pyload-d94868828e60167b2dbb20f39ea4282fd636844e.tar.xz |
Diffstat (limited to 'module/ThreadManager.py')
-rw-r--r-- | module/ThreadManager.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/module/ThreadManager.py b/module/ThreadManager.py index 0462dd8c2..82cb9a449 100644 --- a/module/ThreadManager.py +++ b/module/ThreadManager.py @@ -204,7 +204,12 @@ class ThreadManager: free = [x for x in self.threads if not x.active] - occ = [x.active.pluginname for x in self.threads if x.active and not x.active.plugin.multiDL] + inuse = set([(x.active.pluginname,self.getLimit(x)) for x in self.threads if x.active and x.active.plugin.account]) + inuse = map(lambda x : (x[0], x[1], len([y for y in self.threads if y.active and y.active.pluginname == x[0]])) ,inuse) + onlimit = [x[0] for x in inuse if x[1] > 0 and x[2] >= x[1]] + + occ = [x.active.pluginname for x in self.threads if x.active and not x.active.plugin.multiDL] + onlimit + occ.sort() occ = tuple(set(occ)) job = self.core.files.getJob(occ) @@ -238,6 +243,10 @@ class ThreadManager: else: thread = PluginThread.DecrypterThread(self, job) + def getLimit(self, thread): + limit = thread.active.plugin.account.getAccountData(thread.active.plugin.user)["options"].get("limitDL",["0"])[0] + return int(limit) + def cleanup(self): """do global cleanup, should be called when finished with pycurl""" pycurl.global_cleanup() |