From 5463da932d15aa2e7551bcc06faee9a810a7950c Mon Sep 17 00:00:00 2001 From: Nils Hesse Date: Wed, 13 Feb 2013 22:46:17 +0100 Subject: Add support for limited connections to the Reload.cc plugin --- module/plugins/hoster/ReloadCc.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'module') 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: -- cgit v1.2.3