summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nils Hesse <nphesse@gmail.com> 2013-02-13 22:46:17 +0100
committerGravatar Nils Hesse <nphesse@gmail.com> 2013-02-13 22:46:17 +0100
commit5463da932d15aa2e7551bcc06faee9a810a7950c (patch)
tree472d2b4102a946a281206f8ec5e7ad623dbfbad8
parentEnable better error handling for the Reload.cc plugin (diff)
downloadpyload-5463da932d15aa2e7551bcc06faee9a810a7950c.tar.xz
Add support for limited connections to the Reload.cc plugin
-rw-r--r--module/plugins/hoster/ReloadCc.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/module/plugins/hoster/ReloadCc.py b/module/plugins/hoster/ReloadCc.py
index a038594dc..d56247868 100644
--- a/module/plugins/hoster/ReloadCc.py
+++ b/module/plugins/hoster/ReloadCc.py
@@ -72,8 +72,19 @@ class ReloadCc(Hoster):
data = json_loads(answer)
# Check status and decide what to do
- status = data['status']
+ status = data.get('status', None)
if status == "ok":
+ conn_limit = data.get('msg', 0)
+ # API says these connections are limited
+ # Make sure this limit is used - the download will fail if not
+ if conn_limit > 0:
+ try:
+ self.limitDL = int(conn_limit)
+ except ValueError:
+ self.limitDL = 1
+ else:
+ self.limitDL = 0
+
try:
self.download(data['link'], disposition=True)
except BadHeader as e: