From 0072668fd976f9ce4dbaac7e807791f21cbe07ed Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 6 Jul 2014 18:57:55 +0200 Subject: Compute wait time using secondsToMidnight --- module/plugins/hoster/FileserveCom.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 4c678c1b1..f6e102f08 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -16,12 +16,15 @@ """ import re -from module.plugins.Hoster import Hoster + from module.network.RequestFactory import getURL -from module.plugins.internal.CaptchaService import ReCaptcha from module.common.json_layer import json_loads +from module.plugins.internal.CaptchaService import ReCaptcha from module.utils import parseFileSize + +from module.plugins.Hoster import Hoster from module.plugins.Plugin import chunks +from module.plugins.hoster.UnrestrictLi import secondsToMidnight def checkFile(plugin, urls): @@ -47,7 +50,7 @@ class FileserveCom(Hoster): __name__ = "FileserveCom" __type__ = "hoster" __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P[^/]+).*' - __version__ = "0.51" + __version__ = "0.52" __description__ = """Fileserve.com hoster plugin""" __author_name__ = ("jeix", "mkaay", "Paul King", "zoidberg") __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "", "zoidberg@mujmail.cz") @@ -133,8 +136,8 @@ class FileserveCom(Hoster): elif check == "wait": self.doLongWait(self.lastCheck) elif check == "limit": - #download limited reached for today (not a exact time known) - self.setWait(3 * 60 * 60, True) # wait 3 hours #TO-DO: resolve waittime using UnrestrictLi's secondsToMidnight + self.logWarning("Download limited reached for today") + self.setWait(secondsToMidnight(gmt=2), True) self.wait() self.retry() -- cgit v1.2.3 From 04038a2cf0c4c2d9cc9a0c8e8bf9beb6426afae8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 10 Jul 2014 03:02:26 +0200 Subject: Use parseError instead PluginParseError + unified all download pattern attributes as LINK_PATTERN + removed some old patterns (not used anymore) + other code cosmetics --- module/plugins/hoster/FileserveCom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index f6e102f08..ebb6204c3 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -62,9 +62,9 @@ class FileserveCom(Hoster): CAPTCHA_KEY_PATTERN = r"var reCAPTCHA_publickey='(?P[^']+)'" LONG_WAIT_PATTERN = r'
  • You need to wait (\d+) (\w+) to start another download\.
  • ' - LINK_EXPIRED_PATTERN = "Your download link has expired" - DAILY_LIMIT_PATTERN = "Your daily download limit has been reached" - NOT_LOGGED_IN_PATTERN = '
    Login' + LINK_EXPIRED_PATTERN = r'Your download link has expired' + DAILY_LIMIT_PATTERN = r'Your daily download limit has been reached' + NOT_LOGGED_IN_PATTERN = r'Login' # shares code with FilejungleCom and UploadstationCom -- cgit v1.2.3 From 7b8c458cca7d21a029620f98e453f746fce69cd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 16:10:01 +0200 Subject: Prefer single quote for dict key name --- module/plugins/hoster/FileserveCom.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index ebb6204c3..ac12a7892 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -55,8 +55,8 @@ class FileserveCom(Hoster): __author_name__ = ("jeix", "mkaay", "Paul King", "zoidberg") __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "", "zoidberg@mujmail.cz") - URLS = ['http://www.fileserve.com/file/', 'http://www.fileserve.com/link-checker.php', - 'http://www.fileserve.com/checkReCaptcha.php'] + URLS = ["http://www.fileserve.com/file/", "http://www.fileserve.com/link-checker.php", + "http://www.fileserve.com/checkReCaptcha.php"] LINKCHECK_TR = r'\s*(http://www.fileserve\.com/file/.*?)' LINKCHECK_TD = r'(?:<[^>]*>| )*([^<]*)' @@ -93,24 +93,24 @@ class FileserveCom(Hoster): self.logDebug(action) if "fail" in action: - if action["fail"] == "timeLimit": + if action['fail'] == "timeLimit": self.html = self.load(self.url, post={"checkDownload": "showError", "errorType": "timeLimit"}, decode=True) self.doLongWait(re.search(self.LONG_WAIT_PATTERN, self.html)) - elif action["fail"] == "parallelDownload": + elif action['fail'] == "parallelDownload": self.logWarning(_("Parallel download error, now waiting 60s.")) self.retry(wait_time=60, reason="parallelDownload") else: - self.fail("Download check returned %s" % action["fail"]) + self.fail("Download check returned %s" % action['fail']) elif "success" in action: - if action["success"] == "showCaptcha": + if action['success'] == "showCaptcha": self.doCaptcha() self.doTimmer() - elif action["success"] == "showTimmer": + elif action['success'] == "showTimmer": self.doTimmer() else: @@ -173,7 +173,7 @@ class FileserveCom(Hoster): 'recaptcha_response_field': code, 'recaptcha_shortencode_field': self.file_id})) self.logDebug("reCaptcha response : %s" % response) - if not response["success"]: + if not response['success']: self.invalidCaptcha() else: self.correctCaptcha() @@ -193,7 +193,7 @@ class FileserveCom(Hoster): #try api download response = self.load("http://app.fileserve.com/api/download/premium/", post={"username": self.user, - "password": self.account.getAccountData(self.user)["password"], + "password": self.account.getAccountData(self.user)['password'], "shorten": self.file_id}, decode=True) if response: -- cgit v1.2.3 From 05d258d98dd8c2faf0b769840fa1e3c4acccdce8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:25:14 +0200 Subject: Fix and improve 5060e4c6374a5116d0d8b02528f910f8c5f8bcf9 --- module/plugins/hoster/FileserveCom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index ac12a7892..97c931ee4 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -152,7 +152,7 @@ class FileserveCom(Hoster): if self.__name__ == "FilejungleCom": found = re.search(r'"waitTime":(\d+)', response) - if not found: + if found is None: self.fail("Cannot get wait time") wait_time = int(found.group(1)) else: -- cgit v1.2.3 From 9395182da7afed55a29bde1c7cbefe4204e783f0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 20 Jul 2014 03:02:09 +0200 Subject: Store all re.search/match object as "m" instead "found" --- module/plugins/hoster/FileserveCom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 97c931ee4..52f39bab8 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -151,10 +151,10 @@ class FileserveCom(Hoster): self.fail("Failed getting wait time") if self.__name__ == "FilejungleCom": - found = re.search(r'"waitTime":(\d+)', response) - if found is None: + m = re.search(r'"waitTime":(\d+)', response) + if m is None: self.fail("Cannot get wait time") - wait_time = int(found.group(1)) + wait_time = int(m.group(1)) else: wait_time = int(response) + 3 -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/hoster/FileserveCom.py | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 52f39bab8..b7f051d80 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -1,30 +1,14 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . -""" - import re -from module.network.RequestFactory import getURL from module.common.json_layer import json_loads -from module.plugins.internal.CaptchaService import ReCaptcha -from module.utils import parseFileSize - +from module.network.RequestFactory import getURL from module.plugins.Hoster import Hoster from module.plugins.Plugin import chunks from module.plugins.hoster.UnrestrictLi import secondsToMidnight +from module.plugins.internal.CaptchaService import ReCaptcha +from module.utils import parseFileSize def checkFile(plugin, urls): @@ -49,8 +33,10 @@ def checkFile(plugin, urls): class FileserveCom(Hoster): __name__ = "FileserveCom" __type__ = "hoster" - __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P[^/]+).*' __version__ = "0.52" + + __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P[^/]+).*' + __description__ = """Fileserve.com hoster plugin""" __author_name__ = ("jeix", "mkaay", "Paul King", "zoidberg") __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "", "zoidberg@mujmail.cz") @@ -66,7 +52,6 @@ class FileserveCom(Hoster): DAILY_LIMIT_PATTERN = r'Your daily download limit has been reached' NOT_LOGGED_IN_PATTERN = r'Login' - # shares code with FilejungleCom and UploadstationCom def setup(self): self.resumeDownload = self.multiDL = self.premium -- cgit v1.2.3