summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/ThreadManager.py11
-rw-r--r--module/network/HTTPDownload.py2
-rw-r--r--module/web/json_app.py4
-rw-r--r--module/web/pyload_app.py6
-rw-r--r--module/web/templates/default/settings.html6
5 files changed, 26 insertions, 3 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()
diff --git a/module/network/HTTPDownload.py b/module/network/HTTPDownload.py
index 56f1cb1e4..40e2e69e1 100644
--- a/module/network/HTTPDownload.py
+++ b/module/network/HTTPDownload.py
@@ -142,6 +142,8 @@ class HTTPDownload():
chunksDone = 0
chunksCreated = False
+ if self.info.getCount() > 1: # This is a resume, if we were chunked originally assume still can
+ self.chunkSupport=True
while 1:
#need to create chunks
diff --git a/module/web/json_app.py b/module/web/json_app.py
index 7a6baffd8..36ecf22aa 100644
--- a/module/web/json_app.py
+++ b/module/web/json_app.py
@@ -400,6 +400,8 @@ def update_accounts():
PYLOAD.update_account(plugin, user, value)
elif action == "time" and value and "-" in value:
PYLOAD.update_account(plugin, user, options={"time": [value]})
+ elif action == "limitdl" and value and value.isdigit():
+ PYLOAD.update_account(plugin, user, options={"limitDL": [value]})
elif action == "delete" and value:
PYLOAD.remove_account(plugin, user)
@@ -463,4 +465,4 @@ def make_dir():
return {"response": "success", "path": path, "name": name}
except:
- return HTTPError() \ No newline at end of file
+ return HTTPError()
diff --git a/module/web/pyload_app.py b/module/web/pyload_app.py
index 784127f72..c7af88275 100644
--- a/module/web/pyload_app.py
+++ b/module/web/pyload_app.py
@@ -316,6 +316,10 @@ def config():
data["time"] = data["options"]["time"][0]
except:
data["time"] = "0:00-0:00"
+ if data["options"].has_key("limitDL"):
+ data["limitdl"] = data["options"]["limitDL"][0]
+ else:
+ data["limitdl"] = "0"
return render_to_response('settings.html',
{'conf': {'plugin': plugin_menu, 'general': conf_menu, 'accs': accs}},
@@ -600,4 +604,4 @@ def info():
"webif": conf["webinterface"]["port"]["value"],
"language": conf["general"]["language"]["value"]}
- return render_to_response("info.html", data, [pre_processor]) \ No newline at end of file
+ return render_to_response("info.html", data, [pre_processor])
diff --git a/module/web/templates/default/settings.html b/module/web/templates/default/settings.html
index fc33ca64a..776089c47 100644
--- a/module/web/templates/default/settings.html
+++ b/module/web/templates/default/settings.html
@@ -126,6 +126,7 @@
<th>{{ _("Valid until") }}</th>
<th>{{ _("Traffic left") }}</th>
<th>{{ _("Time") }}</th>
+ <th>{{ _("Max Parallel") }}</th>
<th>{{ _("Delete?") }}</th>
</tr>
</thead>
@@ -182,6 +183,11 @@
size="7" value="{{account.time}}"/>
</td>
<td>
+ <input id="{{plugin}}|limitdl;{{account.login}}"
+ name="{{plugin}}|limitdl;{{account.login}}" type="text"
+ size="2" value="{{account.limitdl}}"/>
+ </td>
+ <td>
<input id="{{plugin}}|delete;{{account.login}}"
name="{{plugin}}|delete;{{account.login}}" type="checkbox"
value="True"/>