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 From 0d220d634e512d89bda540f91c643b361c82ea8a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Sep 2014 01:38:32 +0200 Subject: Logging string cosmetics --- module/plugins/hoster/FileserveCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index b7f051d80..7ddff112e 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -103,7 +103,7 @@ class FileserveCom(Hoster): # show download link response = self.load(self.url, post={"downloadLink": "show"}, decode=True) - self.logDebug("show downloadLink response : %s" % response) + self.logDebug("Show downloadLink response : %s" % response) if "fail" in response: self.fail("Couldn't retrieve download url") @@ -130,7 +130,7 @@ class FileserveCom(Hoster): def doTimmer(self): response = self.load(self.url, post={"downloadLink": "wait"}, decode=True) - self.logDebug("wait response : %s" % response[:80]) + self.logDebug("Wait response : %s" % response[:80]) if "fail" in response: self.fail("Failed getting wait time") -- cgit v1.2.3 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 18:57:59 +0200 Subject: New __authors__ key replaces __author_name__ and __author_mail__ + Whitespaces and EOF fixup --- module/plugins/hoster/FileserveCom.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 7ddff112e..bc1a52377 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -38,8 +38,11 @@ class FileserveCom(Hoster): __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") + __authors__ = [("jeix", "jeix@hasnomail.de"), + ("mkaay", "mkaay@mkaay.de"), + ("Paul King", None), + ("zoidberg", "zoidberg@mujmail.cz")] + URLS = ["http://www.fileserve.com/file/", "http://www.fileserve.com/link-checker.php", "http://www.fileserve.com/checkReCaptcha.php"] -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- module/plugins/hoster/FileserveCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index bc1a52377..ff7d4f608 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -38,6 +38,7 @@ class FileserveCom(Hoster): __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P[^/]+).*' __description__ = """Fileserve.com hoster plugin""" + __license__ = "GPLv3" __authors__ = [("jeix", "jeix@hasnomail.de"), ("mkaay", "mkaay@mkaay.de"), ("Paul King", None), -- cgit v1.2.3 From c5d1a4fd8943877c6d2eb3843e0de725dba5191e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:09:53 +0200 Subject: Pattern update 2 --- module/plugins/hoster/FileserveCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index ff7d4f608..ae38ee890 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -47,14 +47,14 @@ class FileserveCom(Hoster): 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_TR = r'\s*(http://www\.fileserve\.com/file/.*?)' LINKCHECK_TD = r'(?:<[^>]*>| )*([^<]*)' 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 = r'Your download link has expired' DAILY_LIMIT_PATTERN = r'Your daily download limit has been reached' - NOT_LOGGED_IN_PATTERN = r'Login' + NOT_LOGGED_IN_PATTERN = r'Login' def setup(self): -- cgit v1.2.3 From 8939f015a688a07ec7d0bd14b6a3704f6a2cb4a0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:12:40 +0200 Subject: Pattern update 3 --- 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 ae38ee890..4e722eb9f 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -50,7 +50,7 @@ class FileserveCom(Hoster): LINKCHECK_TR = r'\s*(http://www\.fileserve\.com/file/.*?)' LINKCHECK_TD = r'(?:<[^>]*>| )*([^<]*)' - CAPTCHA_KEY_PATTERN = r"var reCAPTCHA_publickey='(?P[^']+)'" + 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 = r'Your download link has expired' DAILY_LIMIT_PATTERN = r'Your daily download limit has been reached' -- cgit v1.2.3 From 0eb6e7ec4a1144dcca824d8add049787d3da1762 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 22 Oct 2014 19:44:59 +0200 Subject: Two space before function declaration --- module/plugins/hoster/FileserveCom.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 4e722eb9f..7a06472d3 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -64,6 +64,7 @@ class FileserveCom(Hoster): self.url = "%s%s" % (self.URLS[0], self.file_id) self.logDebug("File ID: %s URL: %s" % (self.file_id, self.url)) + def process(self, pyfile): pyfile.name, pyfile.size, status, self.url = checkFile(self, [self.url])[0] if status != 2: @@ -75,6 +76,7 @@ class FileserveCom(Hoster): else: self.handleFree() + def handleFree(self): self.html = self.load(self.url) action = self.load(self.url, post={"checkDownload": "check"}, decode=True) @@ -132,6 +134,7 @@ class FileserveCom(Hoster): self.thread.m.reconnecting.wait(3) # Ease issue with later downloads appearing to be in parallel + def doTimmer(self): response = self.load(self.url, post={"downloadLink": "wait"}, decode=True) self.logDebug("Wait response : %s" % response[:80]) @@ -150,6 +153,7 @@ class FileserveCom(Hoster): self.setWait(wait_time) self.wait() + def doCaptcha(self): captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group("key") recaptcha = ReCaptcha(self) @@ -170,12 +174,14 @@ class FileserveCom(Hoster): else: self.fail("Invalid captcha") + def doLongWait(self, m): wait_time = (int(m.group(1)) * {'seconds': 1, 'minutes': 60, 'hours': 3600}[m.group(2)]) if m else 12 * 60 self.setWait(wait_time, True) self.wait() self.retry() + def handlePremium(self): premium_url = None if self.__name__ == "FileserveCom": -- cgit v1.2.3 From 8cde8385b0224f8fa26758f6c2b6b782e5fb3663 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 23 Oct 2014 22:34:36 +0200 Subject: Call error instead fail in some plugins --- module/plugins/hoster/FileserveCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 7a06472d3..0f8372cf7 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -105,13 +105,13 @@ class FileserveCom(Hoster): self.doTimmer() else: - self.fail("Unknown server response") + self.error("Unknown server response") # show download link response = self.load(self.url, post={"downloadLink": "show"}, decode=True) self.logDebug("Show downloadLink response : %s" % response) if "fail" in response: - self.fail("Couldn't retrieve download url") + self.error("Couldn't retrieve download url") # this may either download our file or forward us to an error page self.download(self.url, post={"download": "normal"}) -- cgit v1.2.3 From 4da90891eb2544ac15a7d512aba8cb357f68ee5f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 01:11:29 +0200 Subject: Spare code cosmetics --- module/plugins/hoster/FileserveCom.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 0f8372cf7..b3f197736 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -15,7 +15,7 @@ def checkFile(plugin, urls): html = getURL(plugin.URLS[1], post={"urls": "\n".join(urls)}, decode=True) file_info = [] - for li in re.finditer(plugin.LINKCHECK_TR, html, re.DOTALL): + for li in re.finditer(plugin.LINKCHECK_TR, html, re.S): try: cols = re.findall(plugin.LINKCHECK_TD, li.group(1)) if cols: @@ -160,12 +160,10 @@ class FileserveCom(Hoster): for _ in xrange(5): challenge, code = recaptcha.challenge(captcha_key) - response = json_loads(self.load(self.URLS[2], post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field': code, 'recaptcha_shortencode_field': self.file_id})) - self.logDebug("reCaptcha response : %s" % response) if not response['success']: self.invalidCaptcha() else: -- cgit v1.2.3 From 1c4bf83881d2a22da3773666a580d51f6b57bfd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Oct 2014 03:07:21 +0200 Subject: Avoid gettext conflict due variable `_` --- 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 b3f197736..8aafb5c0c 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -158,7 +158,7 @@ class FileserveCom(Hoster): captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group("key") recaptcha = ReCaptcha(self) - for _ in xrange(5): + for _i in xrange(5): challenge, code = recaptcha.challenge(captcha_key) response = json_loads(self.load(self.URLS[2], post={'recaptcha_challenge_field': challenge, -- cgit v1.2.3 From 9f2ebe486a3e155fb6a60e07cccb77ab6a772eb2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 26 Oct 2014 02:31:54 +0200 Subject: Extend translation support in plugins + a lot of code cosmetics and typo fixes --- 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 8aafb5c0c..9fded2dd8 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -91,11 +91,11 @@ class FileserveCom(Hoster): self.doLongWait(re.search(self.LONG_WAIT_PATTERN, self.html)) elif action['fail'] == "parallelDownload": - self.logWarning(_("Parallel download error, now waiting 60s.")) + 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": @@ -105,13 +105,13 @@ class FileserveCom(Hoster): self.doTimmer() else: - self.error("Unknown server response") + self.error(_("Unknown server response")) # show download link response = self.load(self.url, post={"downloadLink": "show"}, decode=True) self.logDebug("Show downloadLink response : %s" % response) if "fail" in response: - self.error("Couldn't retrieve download url") + self.error(_("Couldn't retrieve download url")) # this may either download our file or forward us to an error page self.download(self.url, post={"download": "normal"}) @@ -127,7 +127,7 @@ class FileserveCom(Hoster): elif check == "wait": self.doLongWait(self.lastCheck) elif check == "limit": - self.logWarning("Download limited reached for today") + self.logWarning(_("Download limited reached for today")) self.setWait(secondsToMidnight(gmt=2), True) self.wait() self.retry() @@ -140,12 +140,12 @@ class FileserveCom(Hoster): self.logDebug("Wait response : %s" % response[:80]) if "fail" in response: - self.fail("Failed getting wait time") + self.fail(_("Failed getting wait time")) if self.__name__ == "FilejungleCom": m = re.search(r'"waitTime":(\d+)', response) if m is None: - self.fail("Cannot get wait time") + self.fail(_("Cannot get wait time")) wait_time = int(m.group(1)) else: wait_time = int(response) + 3 @@ -170,7 +170,7 @@ class FileserveCom(Hoster): self.correctCaptcha() break else: - self.fail("Invalid captcha") + self.fail(_("Invalid captcha")) def doLongWait(self, m): @@ -209,7 +209,7 @@ class FileserveCom(Hoster): if check == "login": self.account.relogin(self.user) - self.retry(reason=_("Not logged in.")) + self.retry(reason=_("Not logged in")) def getInfo(urls): -- cgit v1.2.3 From 146fe1e309c33ab149bfaf58ad86c0dd4fb9b156 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 27 Oct 2014 01:18:45 +0100 Subject: Spare code cosmetics --- 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 9fded2dd8..d11f631c2 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -92,7 +92,7 @@ class FileserveCom(Hoster): elif action['fail'] == "parallelDownload": self.logWarning(_("Parallel download error, now waiting 60s")) - self.retry(wait_time=60, reason="parallelDownload") + self.retry(wait_time=60, reason=_("parallelDownload")) else: self.fail(_("Download check returned: %s") % action['fail']) -- cgit v1.2.3 From 34984dae733c3f3d47b41a0acfba3724d53c65a1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:52:10 +0100 Subject: Code cosmetics: plugin class attributes --- module/plugins/hoster/FileserveCom.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index d11f631c2..9707090a4 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -31,18 +31,18 @@ def checkFile(plugin, urls): class FileserveCom(Hoster): - __name__ = "FileserveCom" - __type__ = "hoster" + __name__ = "FileserveCom" + __type__ = "hoster" __version__ = "0.52" __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P[^/]+).*' __description__ = """Fileserve.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("jeix", "jeix@hasnomail.de"), - ("mkaay", "mkaay@mkaay.de"), - ("Paul King", None), - ("zoidberg", "zoidberg@mujmail.cz")] + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de"), + ("mkaay", "mkaay@mkaay.de"), + ("Paul King", None), + ("zoidberg", "zoidberg@mujmail.cz")] URLS = ["http://www.fileserve.com/file/", "http://www.fileserve.com/link-checker.php", -- cgit v1.2.3 From c9e31d875d32de31e54959b82bc35eff2b3e0f3f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 10 Nov 2014 00:19:51 +0100 Subject: Code cosmetics --- module/plugins/hoster/FileserveCom.py | 52 +++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 9707090a4..2266e49b0 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -108,9 +108,9 @@ class FileserveCom(Hoster): self.error(_("Unknown server response")) # show download link - response = self.load(self.url, post={"downloadLink": "show"}, decode=True) - self.logDebug("Show downloadLink response : %s" % response) - if "fail" in response: + res = self.load(self.url, post={"downloadLink": "show"}, decode=True) + self.logDebug("Show downloadLink response: %s" % res) + if "fail" in res: self.error(_("Couldn't retrieve download url")) # this may either download our file or forward us to an error page @@ -136,19 +136,19 @@ class FileserveCom(Hoster): def doTimmer(self): - response = self.load(self.url, post={"downloadLink": "wait"}, decode=True) - self.logDebug("Wait response : %s" % response[:80]) + res = self.load(self.url, post={"downloadLink": "wait"}, decode=True) + self.logDebug("Wait response: %s" % res[:80]) - if "fail" in response: + if "fail" in res: self.fail(_("Failed getting wait time")) if self.__name__ == "FilejungleCom": - m = re.search(r'"waitTime":(\d+)', response) + m = re.search(r'"waitTime":(\d+)', res) if m is None: self.fail(_("Cannot get wait time")) wait_time = int(m.group(1)) else: - wait_time = int(response) + 3 + wait_time = int(res) + 3 self.setWait(wait_time) self.wait() @@ -160,11 +160,11 @@ class FileserveCom(Hoster): for _i in xrange(5): challenge, code = recaptcha.challenge(captcha_key) - response = json_loads(self.load(self.URLS[2], - post={'recaptcha_challenge_field': challenge, - 'recaptcha_response_field': code, - 'recaptcha_shortencode_field': self.file_id})) - if not response['success']: + res = json_loads(self.load(self.URLS[2], + post={'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': code, + 'recaptcha_shortencode_field': self.file_id})) + if not res['success']: self.invalidCaptcha() else: self.correctCaptcha() @@ -184,23 +184,23 @@ class FileserveCom(Hoster): premium_url = None if self.__name__ == "FileserveCom": #try api download - response = self.load("http://app.fileserve.com/api/download/premium/", - post={"username": self.user, - "password": self.account.getAccountData(self.user)['password'], - "shorten": self.file_id}, - decode=True) - if response: - response = json_loads(response) - if response['error_code'] == "302": - premium_url = response['next'] - elif response['error_code'] in ["305", "500"]: + res = self.load("http://app.fileserve.com/api/download/premium/", + post={"username": self.user, + "password": self.account.getAccountData(self.user)['password'], + "shorten": self.file_id}, + decode=True) + if res: + res = json_loads(res) + if res['error_code'] == "302": + premium_url = res['next'] + elif res['error_code'] in ["305", "500"]: self.tempOffline() - elif response['error_code'] in ["403", "605"]: + elif res['error_code'] in ["403", "605"]: self.resetAccount() - elif response['error_code'] in ["606", "607", "608"]: + elif res['error_code'] in ["606", "607", "608"]: self.offline() else: - self.logError(response['error_code'], response['error_message']) + self.logError(res['error_code'], res['error_message']) self.download(premium_url or self.pyfile.url) -- cgit v1.2.3 From 67587fbe0335cacfde28a86ba729b9d567ce1da7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 7 Dec 2014 00:27:18 +0100 Subject: Plugin code cosmetics (3) --- module/plugins/hoster/FileserveCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 2266e49b0..82d40fba6 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -59,9 +59,9 @@ class FileserveCom(Hoster): def setup(self): self.resumeDownload = self.multiDL = self.premium - self.file_id = re.match(self.__pattern__, self.pyfile.url).group('id') - self.url = "%s%s" % (self.URLS[0], self.file_id) + self.url = "%s%s" % (self.URLS[0], self.file_id) + self.logDebug("File ID: %s URL: %s" % (self.file_id, self.url)) -- cgit v1.2.3 From 4d578cb15f3d6edd036e438e504739b97660f93e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 9 Dec 2014 16:58:35 +0100 Subject: Spare 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 82d40fba6..871a3dd26 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -159,10 +159,10 @@ class FileserveCom(Hoster): recaptcha = ReCaptcha(self) for _i in xrange(5): - challenge, code = recaptcha.challenge(captcha_key) + challenge, response = recaptcha.challenge(captcha_key) res = json_loads(self.load(self.URLS[2], - post={'recaptcha_challenge_field': challenge, - 'recaptcha_response_field': code, + post={'recaptcha_challenge_field' : challenge, + 'recaptcha_response_field' : response, 'recaptcha_shortencode_field': self.file_id})) if not res['success']: self.invalidCaptcha() -- cgit v1.2.3 From 854efeb463bd98cb8e22f1f78f5ce97e6c0ab49f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 22 Dec 2014 16:45:04 +0100 Subject: Spare code cosmetics --- module/plugins/hoster/FileserveCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/FileserveCom.py') diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 871a3dd26..2d4478e63 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -35,7 +35,7 @@ class FileserveCom(Hoster): __type__ = "hoster" __version__ = "0.52" - __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P[^/]+).*' + __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P[^/]+).*' __description__ = """Fileserve.com hoster plugin""" __license__ = "GPLv3" @@ -50,7 +50,7 @@ class FileserveCom(Hoster): LINKCHECK_TR = r'\s*(http://www\.fileserve\.com/file/.*?)' LINKCHECK_TD = r'(?:<[^>]*>| )*([^<]*)' - CAPTCHA_KEY_PATTERN = r'var reCAPTCHA_publickey=\'(?P.+?)\'' + CAPTCHA_KEY_PATTERN = r'var reCAPTCHA_publickey=\'(.+?)\'' LONG_WAIT_PATTERN = r'
  • You need to wait (\d+) (\w+) to start another download\.
  • ' LINK_EXPIRED_PATTERN = r'Your download link has expired' DAILY_LIMIT_PATTERN = r'Your daily download limit has been reached' @@ -59,7 +59,7 @@ class FileserveCom(Hoster): def setup(self): self.resumeDownload = self.multiDL = self.premium - self.file_id = re.match(self.__pattern__, self.pyfile.url).group('id') + self.file_id = re.match(self.__pattern__, self.pyfile.url).group('ID') self.url = "%s%s" % (self.URLS[0], self.file_id) self.logDebug("File ID: %s URL: %s" % (self.file_id, self.url)) @@ -155,7 +155,7 @@ class FileserveCom(Hoster): def doCaptcha(self): - captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group("key") + captcha_key = re.search(self.CAPTCHA_KEY_PATTERN, self.html).group(1) recaptcha = ReCaptcha(self) for _i in xrange(5): -- cgit v1.2.3 From b6a2bd53628bd2824bac1dafc7b4eafdf3c815dd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 27 Dec 2014 13:48:03 +0100 Subject: Update plugins after SimpleHoster changes --- 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 2d4478e63..52a071b52 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -6,8 +6,8 @@ from module.common.json_layer import json_loads 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.plugins.internal.SimpleHoster import secondsToMidnight from module.utils import parseFileSize @@ -33,9 +33,9 @@ def checkFile(plugin, urls): class FileserveCom(Hoster): __name__ = "FileserveCom" __type__ = "hoster" - __version__ = "0.52" + __version__ = "0.53" - __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P[^/]+).*' + __pattern__ = r'http://(?:www\.)?fileserve\.com/file/(?P[^/]+)' __description__ = """Fileserve.com hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3