diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-03-10 22:43:02 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-03-10 22:43:02 +0100 |
commit | 3ff4cca68c948c2bad716578169c0106cc1ab1fd (patch) | |
tree | ba08aea6e2d30b1b5a43b35234b84e97636e2200 | |
parent | Update plugins after SimpleHoster changes (diff) | |
download | pyload-3ff4cca68c948c2bad716578169c0106cc1ab1fd.tar.xz |
[BasePlugin] Improve checkDownload
-rw-r--r-- | module/plugins/hoster/BasePlugin.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 42bfed91e..4272ba3b5 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.35" + __version__ = "0.36" __pattern__ = r'^unmatchable$' @@ -85,11 +85,13 @@ class BasePlugin(Hoster): else: self.fail(_("No file downloaded")) #@TODO: Move to hoster class in 0.4.10 - check = self.checkDownload({'empty file': re.compile(r'\A\Z'), - 'html file' : re.compile(r'\A\s*<!DOCTYPE html'), - 'html error': re.compile(r'\A\s*(<.+>)?\d{3}(\Z|\s+)')}) - if check: - self.fail(check.capitalize()) + 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 file' : re.compile(r'\A\s*<!DOCTYPE html'), + 'Unknown error': re.compile(r'[Aa]n error occured while processing your request')}) + if errmsg: + self.logWarning("Bad file", "Waiting 1 minute and retry") + self.retry(3, 60, errmsg) getInfo = create_getInfo(BasePlugin) |