summaryrefslogtreecommitdiffstats
path: root/module/threads
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-01-20 00:01:15 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-01-20 00:01:15 +0100
commit21791b33f033c7a182e64ca6f878bf0ec1d8f88d (patch)
tree66e8063781b61a720dd52520cc6935987ee44ce2 /module/threads
parentcorrected log method (diff)
downloadpyload-21791b33f033c7a182e64ca6f878bf0ec1d8f88d.tar.xz
parallel dl limit for hoster
Diffstat (limited to 'module/threads')
-rw-r--r--module/threads/ThreadManager.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/module/threads/ThreadManager.py b/module/threads/ThreadManager.py
index 612da2536..6a5096b8c 100644
--- a/module/threads/ThreadManager.py
+++ b/module/threads/ThreadManager.py
@@ -30,7 +30,7 @@ import pycurl
from module.PyFile import PyFile
from module.network.RequestFactory import getURL
-from module.utils import lock
+from module.utils import lock, uniqify
from module.utils.fs import free_space
from DecrypterThread import DecrypterThread
@@ -264,14 +264,14 @@ class ThreadManager:
free = [x for x in self.threads if not x.active]
- inuse = set([(x.active.pluginname,self.getLimit(x)) for x in self.threads if x.active and x.active.hasPlugin() and x.active.plugin.account])
+ inuse = uniqify([(x.active.pluginname, x.active.plugin.getDownloadLimit()) for x in self.threads if x.active and x.active.hasPlugin()])
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 0 < x[1] <= x[2]]
occ = [x.active.pluginname for x in self.threads if x.active and x.active.hasPlugin() and not x.active.plugin.multiDL] + onlimit
occ.sort()
- occ = tuple(set(occ))
+ occ = tuple(uniqify(occ))
job = self.core.files.getJob(occ)
if job:
try:
@@ -299,12 +299,6 @@ class ThreadManager:
self.core.files.jobCache[occ] = []
self.core.files.jobCache[occ].append(job.id)
- def getLimit(self, thread):
- limit = thread.active.plugin.account.options.get("limitDL","0")
- if limit == "": limit = "0"
- return int(limit)
-
-
def cleanup(self):
"""do global cleanup, should be called when finished with pycurl"""
pycurl.global_cleanup()