summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-06-09 01:52:24 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-06-09 01:52:24 +0200
commitda1180bc2d428ad52fbbecda8473fc1fb7267438 (patch)
tree1565947cf7b67e21e28f0c27df2f9dd3e91bb1ca
parentNew plugin: TNTVillageScambioeticoOrg (diff)
downloadpyload-da1180bc2d428ad52fbbecda8473fc1fb7267438.tar.xz
[SimpleHoster] Improve checkFile
-rw-r--r--module/plugins/accounts/TusfilesNet.py2
-rw-r--r--module/plugins/crypter/MultiuploadCom.py2
-rw-r--r--module/plugins/crypter/UploadableChFolder.py2
-rw-r--r--module/plugins/hooks/AntiVirus.py2
-rw-r--r--module/plugins/hooks/Captcha9Kw.py2
-rw-r--r--module/plugins/hooks/ExtractArchive.py2
-rw-r--r--module/plugins/hooks/RestartFailed.py2
-rw-r--r--module/plugins/hooks/UpdateManager.py2
-rw-r--r--module/plugins/hoster/LoadTo.py2
-rw-r--r--module/plugins/hoster/TurbobitNet.py2
-rw-r--r--module/plugins/hoster/UpleaCom.py2
-rw-r--r--module/plugins/internal/DeadCrypter.py2
-rw-r--r--module/plugins/internal/DeadHoster.py2
-rw-r--r--module/plugins/internal/SimpleHoster.py52
14 files changed, 37 insertions, 41 deletions
diff --git a/module/plugins/accounts/TusfilesNet.py b/module/plugins/accounts/TusfilesNet.py
index d06ba0583..18e7b0b57 100644
--- a/module/plugins/accounts/TusfilesNet.py
+++ b/module/plugins/accounts/TusfilesNet.py
@@ -11,7 +11,7 @@ class TusfilesNet(XFSAccount):
__type__ = "account"
__version__ = "0.06"
- __description__ = """ Tusfile.net account plugin """
+ __description__ = """Tusfile.net account plugin"""
__license__ = "GPLv3"
__authors__ = [("guidobelix", "guidobelix@hotmail.it")]
diff --git a/module/plugins/crypter/MultiuploadCom.py b/module/plugins/crypter/MultiuploadCom.py
index 41794445a..d0679e118 100644
--- a/module/plugins/crypter/MultiuploadCom.py
+++ b/module/plugins/crypter/MultiuploadCom.py
@@ -11,7 +11,7 @@ class MultiuploadCom(DeadCrypter):
__pattern__ = r'http://(?:www\.)?multiupload\.(com|nl)/\w+'
__config__ = [] #@TODO: Remove in 0.4.10
- __description__ = """ MultiUpload.com decrypter plugin """
+ __description__ = """MultiUpload.com decrypter plugin"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
diff --git a/module/plugins/crypter/UploadableChFolder.py b/module/plugins/crypter/UploadableChFolder.py
index f1eb93323..849aaceea 100644
--- a/module/plugins/crypter/UploadableChFolder.py
+++ b/module/plugins/crypter/UploadableChFolder.py
@@ -13,7 +13,7 @@ class UploadableChFolder(SimpleCrypter):
("use_subfolder" , "bool", "Save package to subfolder" , True),
("subfolder_per_pack", "bool", "Create a subfolder for each package", True)]
- __description__ = """ Uploadable.ch folder decrypter plugin """
+ __description__ = """Uploadable.ch folder decrypter plugin"""
__license__ = "GPLv3"
__authors__ = [("guidobelix", "guidobelix@hotmail.it"),
("Walter Purcaro", "vuolter@gmail.com")]
diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py
index 0b5eb1410..09872650f 100644
--- a/module/plugins/hooks/AntiVirus.py
+++ b/module/plugins/hooks/AntiVirus.py
@@ -91,7 +91,7 @@ class AntiVirus(Hook):
shutil.move(file, self.getConfig('quardir'))
else:
- self.logDebug(_("Successfully moved file to trash"))
+ self.logDebug("Successfully moved file to trash")
elif action == "Quarantine":
pyfile.setCustomStatus(_("file moving"))
diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py
index 7f37c225e..18a078bdb 100644
--- a/module/plugins/hooks/Captcha9Kw.py
+++ b/module/plugins/hooks/Captcha9Kw.py
@@ -139,7 +139,7 @@ class Captcha9Kw(Hook):
self.logError(_("Bad upload: %s") % res)
return
- self.logDebug(_("NewCaptchaID ticket: %s") % res, task.captchaFile)
+ self.logDebug("NewCaptchaID ticket: %s" % res, task.captchaFile)
task.data["ticket"] = res
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index 67ebfc49c..f311d5b49 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -482,7 +482,7 @@ class ExtractArchive(Hook):
self.logWarning(_("Unable to move %s to trash: %s") % (os.path.basename(f), e.message))
else:
- self.logDebug(_("Successfully moved %s to trash") % os.path.basename(f))
+ self.logDebug("Successfully moved %s to trash" % os.path.basename(f))
self.logInfo(name, _("Extracting finished"))
extracted_files = archive.files or archive.list()
diff --git a/module/plugins/hooks/RestartFailed.py b/module/plugins/hooks/RestartFailed.py
index 837d903b2..c29b9cee4 100644
--- a/module/plugins/hooks/RestartFailed.py
+++ b/module/plugins/hooks/RestartFailed.py
@@ -30,7 +30,7 @@ class RestartFailed(Hook):
def periodical(self):
- self.logDebug(_("Restart failed downloads"))
+ self.logDebug("Restart failed downloads")
self.core.api.restartFailed()
diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py
index 249c799d8..f8eb25bc1 100644
--- a/module/plugins/hooks/UpdateManager.py
+++ b/module/plugins/hooks/UpdateManager.py
@@ -39,7 +39,7 @@ class UpdateManager(Hook):
("reloadplugins", "bool", "Monitor plugin code changes in debug mode", True ),
("nodebugupdate", "bool", "Don't update plugins in debug mode" , False)]
- __description__ = """ Check for updates """
+ __description__ = """Check for updates"""
__license__ = "GPLv3"
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py
index 11c96de60..7a9be86e1 100644
--- a/module/plugins/hoster/LoadTo.py
+++ b/module/plugins/hoster/LoadTo.py
@@ -18,7 +18,7 @@ class LoadTo(SimpleHoster):
__pattern__ = r'http://(?:www\.)?load\.to/\w+'
__config__ = [("use_premium", "bool", "Use premium account if available", True)]
- __description__ = """ Load.to hoster plugin """
+ __description__ = """Load.to hoster plugin"""
__license__ = "GPLv3"
__authors__ = [("halfman", "Pulpan3@gmail.com"),
("stickell", "l.stickell@yahoo.it")]
diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py
index 254e06c2a..a4c36bc2a 100644
--- a/module/plugins/hoster/TurbobitNet.py
+++ b/module/plugins/hoster/TurbobitNet.py
@@ -22,7 +22,7 @@ class TurbobitNet(SimpleHoster):
__pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)'
__config__ = [("use_premium", "bool", "Use premium account if available", True)]
- __description__ = """ Turbobit.net hoster plugin """
+ __description__ = """Turbobit.net hoster plugin"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", "zoidberg@mujmail.cz"),
("prOq", None)]
diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py
index 9d460ef98..a6ec0807e 100644
--- a/module/plugins/hoster/UpleaCom.py
+++ b/module/plugins/hoster/UpleaCom.py
@@ -51,7 +51,7 @@ class UpleaCom(XFSHoster):
m = re.search(self.WAIT_PATTERN, self.html)
if m:
- self.logDebug(_("Waiting %s seconds") % m.group(1))
+ self.logDebug("Waiting %s seconds" % m.group(1))
self.wait(m.group(1), True)
self.retry()
diff --git a/module/plugins/internal/DeadCrypter.py b/module/plugins/internal/DeadCrypter.py
index 28ead4c23..ef0d12b91 100644
--- a/module/plugins/internal/DeadCrypter.py
+++ b/module/plugins/internal/DeadCrypter.py
@@ -11,7 +11,7 @@ class DeadCrypter(Crypter):
__pattern__ = r'^unmatchable$'
- __description__ = """ Crypter is no longer available """
+ __description__ = """Crypter is no longer available"""
__license__ = "GPLv3"
__authors__ = [("stickell", "l.stickell@yahoo.it")]
diff --git a/module/plugins/internal/DeadHoster.py b/module/plugins/internal/DeadHoster.py
index 6dc860eea..accb15a78 100644
--- a/module/plugins/internal/DeadHoster.py
+++ b/module/plugins/internal/DeadHoster.py
@@ -11,7 +11,7 @@ class DeadHoster(Hoster):
__pattern__ = r'^unmatchable$'
- __description__ = """ Hoster is no longer available """
+ __description__ = """Hoster is no longer available"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 6f2dc8a6c..2454a5072 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -239,7 +239,7 @@ def secondsToMidnight(gmt=0):
class SimpleHoster(Hoster):
__name__ = "SimpleHoster"
__type__ = "hoster"
- __version__ = "1.63"
+ __version__ = "1.64"
__pattern__ = r'^unmatchable$'
__config__ = [("use_premium", "bool", "Use premium account if available" , True),
@@ -581,47 +581,43 @@ class SimpleHoster(Hoster):
def checkFile(self):
+ lastDownload = fs_encode(self.lastDownload)
+
if self.cTask and not self.lastDownload:
self.invalidCaptcha()
self.retry(10, reason=_("Wrong captcha"))
- elif not self.lastDownload or not os.path.exists(fs_encode(self.lastDownload)):
+ elif not self.lastDownload or not os.path.exists(lastDownload):
self.lastDownload = ""
self.error(self.pyfile.error or _("No file downloaded"))
else:
- self.logDebug(_("Checking last downloaded file with built-in rules"))
- errmsg = self.checkDownload({'Empty file': re.compile(r'\A((.|)(\2|\s)*)\Z')})
-
- if errmsg:
- return
-
- self.logDebug(_("Checking last downloaded file with custom rules"))
-
- if self.CHECK_FILE:
- rules = [(r, getattr(self, a)) for r, a in (("IP blocked" , "IP_BLOCKED_PATTERN" ),
- ("Download limit", "DL_LIMIT_PATTERN" ),
- ("Size limit" , "SIZE_LIMIT_PATTERN" ),
- ("Error" , "ERROR_PATTERN" ),
- ("Premium only" , "PREMIUM_ONLY_PATTERN"),
- ("Wait error" , "WAIT_PATTERN" )) if hasattr(self, a)]
- self.FILE_ERRORS.extend(rules)
+ #@TODO: Move to Hoster in 0.4.10
+ if os.stat(lastDownload).st_size < 1 or self.checkDownload({'Empty file': re.compile(r'\A((.|)(\2|\s)*)\Z')}):
+ self.error(_("Empty file"))
+ self.logDebug("Checking last downloaded file with built-in rules")
for r, p in self.FILE_ERRORS:
errmsg = self.checkDownload({r: re.compile(p)})
+ if errmsg is not None:
+ errmsg = errmsg.strip().capitalize()
- if not errmsg:
- continue
-
- errmsg = errmsg.strip().capitalize()
+ try:
+ errmsg += " | " + self.lastCheck.group(1).strip()
+ except Exception:
+ pass
- try:
- errmsg += " | " + self.lastCheck.group(1).strip()
- except Exception:
- pass
+ self.logWarning("Check result: " + errmsg, "Waiting 1 minute and retry")
+ self.wantReconnect = True
+ self.retry(wait_time=60, reason=errmsg)
+ else:
+ if self.CHECK_FILE:
+ self.logDebug("Checking last downloaded file with custom rules")
+ with open(lastDownload, "rb") as f:
+ self.html = f.read(50000) #@TODO: Recheck in 0.4.10
+ self.checkErrors()
- self.logWarning("Check result: " + errmsg, "Waiting 1 minute and retry")
- self.retry(3, 60, errmsg)
+ self.logDebug("No file errors found")
def checkErrors(self):