diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-03-10 23:05:38 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-03-10 23:05:38 +0100 |
commit | daddc7e36dba956d2623626ed0079694940f1b9e (patch) | |
tree | 4a7b3b69d55a06f8a1bd039100b9609195e1f479 /module/plugins | |
parent | Tiny code cosmetics (diff) | |
download | pyload-daddc7e36dba956d2623626ed0079694940f1b9e.tar.xz |
[BasePlugin][SimpleHoster] Improve checkDownload rules
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/hoster/BasePlugin.py | 11 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 16 |
2 files changed, 16 insertions, 11 deletions
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 4272ba3b5..a26a7a180 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -13,7 +13,7 @@ from module.plugins.Hoster import Hoster class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.36" + __version__ = "0.37" __pattern__ = r'^unmatchable$' @@ -86,10 +86,15 @@ class BasePlugin(Hoster): self.fail(_("No file downloaded")) #@TODO: Move to hoster class in 0.4.10 errmsg = self.checkDownload({'Empty file' : re.compile(r'\A\s*\Z'), - 'Html error' : re.compile(r'\A(\s*<.+>)?([\w\s]*([Ee]rror|ERROR)\s*:?)?\s*\d{3}(\Z|\s+)'), + 'Html error' : re.compile(r'\A(?:\s*<.+>)?((?:[\w\s]*(?:[Ee]rror|ERROR)\s*\:?)?\s*\d{3})(?:\Z|\s+)'), 'Html file' : re.compile(r'\A\s*<!DOCTYPE html'), - 'Unknown error': re.compile(r'[Aa]n error occured while processing your request')}) + 'Unknown error': re.compile(r'([Aa]n error occured while processing your request)')}) if errmsg: + try: + errmsg += " | " + self.lastCheck.group(1).strip() + except Exception: + pass + self.logWarning("Bad file", "Waiting 1 minute and retry") self.retry(3, 60, errmsg) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 393af86f5..13a9c134f 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -246,7 +246,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.22" + __version__ = "1.23" __pattern__ = r'^unmatchable$' @@ -510,11 +510,11 @@ class SimpleHoster(Hoster): else: errmsg = self.checkDownload({'Empty file': re.compile(r'\A\s*\Z'), - 'Html error': re.compile(r'\A(\s*<.+>)?([\w\s]*([Ee]rror|ERROR)\s*:?)?\s*\d{3}(\Z|\s+)')}) + 'Html error': re.compile(r'\A(?:\s*<.+>)?((?:[\w\s]*(?:[Ee]rror|ERROR)\s*\:?)?\s*\d{3})(?:\Z|\s+)')}) if not errmsg: for r, p in [('Html file' , re.compile(r'\A\s*<!DOCTYPE html') ), - ('Unknown error', re.compile(r'[Aa]n error occured while processing your request'))]: + ('Unknown error', re.compile(r'([Aa]n error occured while processing your request)'))]: if r not in rules: rules[r] = p @@ -526,12 +526,12 @@ class SimpleHoster(Hoster): errmsg = self.checkDownload(rules).strip().capitalize() - try: - errmsg += " | " + self.lastCheck.group(1).strip() - except Exception: - pass - if errmsg: + try: + errmsg += " | " + self.lastCheck.group(1).strip() + except Exception: + pass + self.logWarning("Bad file", "Waiting 1 minute and retry") self.retry(3, 60, errmsg) |