diff options
-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) |