summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-10 22:37:29 +0100
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-03-10 22:37:29 +0100
commit7f357700f340db51a0de65a8dcc0726a6965ecd3 (patch)
treea401d738eb598c6c3b9823c185c872fe1e034684
parent[SimpleHoster] Improve checkFile routine (diff)
downloadpyload-7f357700f340db51a0de65a8dcc0726a6965ecd3.tar.xz
[SimpleHoster] Improve checkFile routine (2)
-rw-r--r--module/plugins/internal/SimpleHoster.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index ac25423fc..393af86f5 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.21"
+ __version__ = "1.22"
__pattern__ = r'^unmatchable$'
@@ -509,24 +509,27 @@ class SimpleHoster(Hoster):
self.error(self.pyfile.error or _("No file downloaded"))
else:
- errmsg = self.checkDownload({'Empty file': re.compile(r'\A\s*\Z')})
+ 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+)')})
- if errmsg:
- self.lastDownload = ""
- else:
- for r, p in [('html file' , re.compile(r'\A\s*<!DOCTYPE html' )),
- ('html error', re.compile(r'\A\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'))]:
if r not in rules:
rules[r] = p
- for r, a in [('error' , 'ERROR_PATTERN'),
- ('wait error', 'WAIT_PATTERN' )]:
+ for r, a in [('Error' , "ERROR_PATTERN" ),
+ ('Premium only', "PREMIUM_ONLY_PATTERN"),
+ ('Wait error' , "WAIT_PATTERN" )]:
if r not in rules and hasattr(self, a):
rules[r] = getattr(self, a)
- errmsg = self.checkDownload(rules, delete=not self.core.debug).strip().capitalize()
- if self.lastCheck:
- errmsg += " | " + self.lastCheck.group(0).strip()
+ errmsg = self.checkDownload(rules).strip().capitalize()
+
+ try:
+ errmsg += " | " + self.lastCheck.group(1).strip()
+ except Exception:
+ pass
if errmsg:
self.logWarning("Bad file", "Waiting 1 minute and retry")