From dbeb21da8cb2eca52bcfcf8e8686947f41f71683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= Date: Wed, 25 Feb 2015 20:55:13 +0100 Subject: * [ExtractArchive] fixes 'Could not activate UnRar' --- module/plugins/internal/SevenZip.py | 5 +++-- module/plugins/internal/UnRar.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index bfa7f3943..8a3c67f0e 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -11,7 +11,7 @@ from module.utils import fs_encode, save_join class SevenZip(UnRar): __name__ = "SevenZip" - __version__ = "0.09" + __version__ = "0.10" __description__ = """7-Zip extractor plugin""" __license__ = "GPLv3" @@ -47,7 +47,8 @@ class SevenZip(UnRar): p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) out, err = p.communicate() - cls.VERSION = cls.re_version.search(out).group(1) + m = cls.re_version.search(out) + cls.VERSION = m.group(1) if m else '(version unknown)' return True diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index ca8fdd326..7a02ba6bd 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -22,7 +22,7 @@ def renice(pid, value): class UnRar(Extractor): __name__ = "UnRar" - __version__ = "1.14" + __version__ = "1.15" __description__ = """Rar extractor plugin""" __license__ = "GPLv3" @@ -70,7 +70,8 @@ class UnRar(Extractor): p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) out, err = p.communicate() - cls.VERSION = cls.re_version.search(out).group(1) + m = cls.re_version.search(out) + cls.VERSION = m.group(1) if m else '(version unknown)' return True -- cgit v1.2.3 From 93eb54614d512396a5505cb9bdea4e201920b434 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 1 Mar 2015 00:33:21 +0100 Subject: Spare code cosmetics --- module/plugins/internal/CaptchaService.py | 6 +++++- module/plugins/internal/Extractor.py | 4 ++-- module/plugins/internal/SevenZip.py | 2 +- module/plugins/internal/UnRar.py | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py index 6f2c8e06d..fcb8f0095 100644 --- a/module/plugins/internal/CaptchaService.py +++ b/module/plugins/internal/CaptchaService.py @@ -14,6 +14,7 @@ from module.plugins.Plugin import Base #@TODO: Extend (new) Plugin class; remove all `html` args class CaptchaService(Base): __name__ = "CaptchaService" + __type__ = "captcha" __version__ = "0.25" __description__ = """Base captcha service plugin""" @@ -43,6 +44,7 @@ class CaptchaService(Base): class ReCaptcha(CaptchaService): __name__ = "ReCaptcha" + __type__ = "captcha" __version__ = "0.14" __description__ = """ReCaptcha captcha service plugin""" @@ -239,9 +241,9 @@ class ReCaptcha(CaptchaService): return result, None - class AdsCaptcha(CaptchaService): __name__ = "AdsCaptcha" + __type__ = "captcha" __version__ = "0.08" __description__ = """AdsCaptcha captcha service plugin""" @@ -314,6 +316,7 @@ class AdsCaptcha(CaptchaService): class SolveMedia(CaptchaService): __name__ = "SolveMedia" + __type__ = "captcha" __version__ = "0.12" __description__ = """SolveMedia captcha service plugin""" @@ -422,6 +425,7 @@ class SolveMedia(CaptchaService): class AdYouLike(CaptchaService): __name__ = "AdYouLike" + __type__ = "captcha" __version__ = "0.05" __description__ = """AdYouLike captcha service plugin""" diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 8bf1875cf..ee62ebcb7 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -99,11 +99,11 @@ class Extractor: :raises ArchiveError """ raise NotImplementedError - + def test(self): """Testing with Extractors buildt-in method Raises error if password is needed, integrity is questionable or else. - + :raises PasswordError :raises CRCError :raises ArchiveError diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index 8a3c67f0e..a3df52559 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -46,7 +46,7 @@ class SevenZip(UnRar): else: p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) out, err = p.communicate() - + m = cls.re_version.search(out) cls.VERSION = m.group(1) if m else '(version unknown)' diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 7a02ba6bd..eb969bb60 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -90,7 +90,7 @@ class UnRar(Extractor): p = self.call_cmd("t", "-v", fs_encode(self.filename), password=password) self._progress(p) err = p.stderr.read().strip() - + if self.re_wrongpwd.search(err): raise PasswordError -- cgit v1.2.3 From 3a9c167ceca27d57dbef927626fe853a3d0e30b2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 1 Mar 2015 22:41:08 +0100 Subject: [Extractor] Use self.target --- module/plugins/internal/Extractor.py | 2 ++ module/plugins/internal/SevenZip.py | 14 +++++--------- module/plugins/internal/UnRar.py | 18 ++++++++++-------- module/plugins/internal/UnZip.py | 7 +++---- 4 files changed, 20 insertions(+), 21 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index ee62ebcb7..bc8e67c6d 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -3,6 +3,7 @@ import os from module.PyFile import PyFile +from module.utils import fs_encode class ArchiveError(Exception): @@ -71,6 +72,7 @@ class Extractor: fid=None): """ Initialize extractor for specific file """ self.manager = manager + self.target = "'%s'" % fs_encode(filename) self.filename = filename self.out = out self.fullpath = fullpath diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index a3df52559..5280338dc 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -6,7 +6,7 @@ import re from subprocess import Popen, PIPE from module.plugins.internal.UnRar import ArchiveError, CRCError, PasswordError, UnRar, renice -from module.utils import fs_encode, save_join +from module.utils import save_join class SevenZip(UnRar): @@ -54,10 +54,8 @@ class SevenZip(UnRar): def test(self, password): - file = fs_encode(self.filename) - # 7z can't distinguish crc and pw error in test - p = self.call_cmd("l", "-slt", file) + p = self.call_cmd("l", "-slt", self.target) out, err = p.communicate() if self.re_wrongpwd.search(out): @@ -72,9 +70,7 @@ class SevenZip(UnRar): def check(self, password): - file = fs_encode(self.filename) - - p = self.call_cmd("l", "-slt", file) + p = self.call_cmd("l", "-slt", self.target) out, err = p.communicate() # check if output or error macthes the 'wrong password'-Regexp @@ -92,7 +88,7 @@ class SevenZip(UnRar): def extract(self, password=None): command = "x" if self.fullpath else "e" - p = self.call_cmd(command, '-o' + self.out, fs_encode(self.filename), password=password) + p = self.call_cmd(command, '-o' + self.out, self.target, password=password) renice(p.pid, self.renice) @@ -119,7 +115,7 @@ class SevenZip(UnRar): def list(self, password=None): command = "l" if self.fullpath else "l" - p = self.call_cmd(command, fs_encode(self.filename), password=password) + p = self.call_cmd(command, self.target, password=password) out, err = p.communicate() if "Can not open" in err: diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index eb969bb60..188fc88bb 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -8,7 +8,7 @@ from string import digits from subprocess import Popen, PIPE from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError -from module.utils import decode, fs_encode, save_join +from module.utils import fs_decode, save_join def renice(pid, value): @@ -56,6 +56,7 @@ class UnRar(Extractor): out, err = p.communicate() cls.__name__ = "RAR" cls.REPAIR = True + except OSError: cls.CMD = os.path.join(pypath, "UnRAR.exe") p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) @@ -66,6 +67,7 @@ class UnRar(Extractor): out, err = p.communicate() cls.__name__ = "RAR" cls.REPAIR = True + except OSError: #: fallback to unrar p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) out, err = p.communicate() @@ -87,7 +89,7 @@ class UnRar(Extractor): def test(self, password): - p = self.call_cmd("t", "-v", fs_encode(self.filename), password=password) + p = self.call_cmd("t", "-v", self.target, password=password) self._progress(p) err = p.stderr.read().strip() @@ -99,7 +101,7 @@ class UnRar(Extractor): def check(self, password): - p = self.call_cmd("l", "-v", fs_encode(self.filename), password=password) + p = self.call_cmd("l", "-v", self.target, password=password) out, err = p.communicate() if self.re_wrongpwd.search(err): @@ -115,7 +117,7 @@ class UnRar(Extractor): def repair(self): - p = self.call_cmd("rc", fs_encode(self.filename)) + p = self.call_cmd("rc", self.target) # communicate and retrieve stderr self._progress(p) @@ -147,7 +149,7 @@ class UnRar(Extractor): def extract(self, password=None): command = "x" if self.fullpath else "e" - p = self.call_cmd(command, fs_encode(self.filename), self.out, password=password) + p = self.call_cmd(command, self.target, self.out, password=password) renice(p.pid, self.renice) @@ -187,7 +189,7 @@ class UnRar(Extractor): def list(self, password=None): command = "vb" if self.fullpath else "lb" - p = self.call_cmd(command, "-v", fs_encode(self.filename), password=password) + p = self.call_cmd(command, "-v", self.target, password=password) out, err = p.communicate() if "Cannot open" in err: @@ -199,12 +201,12 @@ class UnRar(Extractor): result = set() if not self.fullpath and self.VERSION.startswith('5'): # NOTE: Unrar 5 always list full path - for f in decode(out).splitlines(): + for f in fs_decode(out).splitlines(): f = save_join(self.out, os.path.basename(f.strip())) if os.path.isfile(f): result.add(save_join(self.out, os.path.basename(f))) else: - for f in decode(out).splitlines(): + for f in fs_decode(out).splitlines(): f = f.strip() result.add(save_join(self.out, f)) diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py index d95afbc70..dd57a54a7 100644 --- a/module/plugins/internal/UnZip.py +++ b/module/plugins/internal/UnZip.py @@ -7,7 +7,6 @@ import sys import zipfile from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError -from module.utils import fs_encode class UnZip(Extractor): @@ -29,7 +28,7 @@ class UnZip(Extractor): def list(self, password=None): - with zipfile.ZipFile(fs_encode(self.filename), 'r', allowZip64=True) as z: + with zipfile.ZipFile(self.target, 'r', allowZip64=True) as z: z.setpassword(password) return z.namelist() @@ -39,7 +38,7 @@ class UnZip(Extractor): def test(self): - with zipfile.ZipFile(fs_encode(self.filename), 'r', allowZip64=True) as z: + with zipfile.ZipFile(self.target, 'r', allowZip64=True) as z: badfile = z.testzip() if badfile: @@ -50,7 +49,7 @@ class UnZip(Extractor): def extract(self, password=None): try: - with zipfile.ZipFile(fs_encode(self.filename), 'r', allowZip64=True) as z: + with zipfile.ZipFile(self.target, 'r', allowZip64=True) as z: z.setpassword(password) badfile = z.testzip() -- cgit v1.2.3 From 8b432eb80715f84800febb88620d943211e28051 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 4 Mar 2015 02:21:50 +0100 Subject: Revert 3a9c167ceca27d57dbef927626fe853a3d0e30b2 --- module/plugins/internal/Extractor.py | 22 ++++++++++------------ module/plugins/internal/SevenZip.py | 10 +++++----- module/plugins/internal/UnRar.py | 12 ++++++------ module/plugins/internal/UnZip.py | 7 ++++--- 4 files changed, 25 insertions(+), 26 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index bc8e67c6d..4b21cc49c 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -3,7 +3,6 @@ import os from module.PyFile import PyFile -from module.utils import fs_encode class ArchiveError(Exception): @@ -71,17 +70,16 @@ class Extractor: keepbroken=False, fid=None): """ Initialize extractor for specific file """ - self.manager = manager - self.target = "'%s'" % fs_encode(filename) - self.filename = filename - self.out = out - self.fullpath = fullpath - self.overwrite = overwrite - self.excludefiles = excludefiles - self.renice = renice - self.delete = delete - self.keepbroken = keepbroken - self.files = [] #: Store extracted files here + self.manager = manager + self.filename = filename + self.out = out + self.fullpath = fullpath + self.overwrite = overwrite + self.excludefiles = excludefiles + self.renice = renice + self.delete = delete + self.keepbroken = keepbroken + self.files = [] #: Store extracted files here pyfile = self.manager.core.files.getFile(fid) if fid else None self.notifyProgress = lambda x: pyfile.setProgress(x) if pyfile else lambda x: None diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index 5280338dc..b5b113566 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -6,7 +6,7 @@ import re from subprocess import Popen, PIPE from module.plugins.internal.UnRar import ArchiveError, CRCError, PasswordError, UnRar, renice -from module.utils import save_join +from module.utils import fs_encode, save_join class SevenZip(UnRar): @@ -55,7 +55,7 @@ class SevenZip(UnRar): def test(self, password): # 7z can't distinguish crc and pw error in test - p = self.call_cmd("l", "-slt", self.target) + p = self.call_cmd("l", "-slt", fs_encode(self.filename)) out, err = p.communicate() if self.re_wrongpwd.search(out): @@ -70,7 +70,7 @@ class SevenZip(UnRar): def check(self, password): - p = self.call_cmd("l", "-slt", self.target) + p = self.call_cmd("l", "-slt", fs_encode(self.filename)) out, err = p.communicate() # check if output or error macthes the 'wrong password'-Regexp @@ -88,7 +88,7 @@ class SevenZip(UnRar): def extract(self, password=None): command = "x" if self.fullpath else "e" - p = self.call_cmd(command, '-o' + self.out, self.target, password=password) + p = self.call_cmd(command, '-o' + self.out, fs_encode(self.filename), password=password) renice(p.pid, self.renice) @@ -115,7 +115,7 @@ class SevenZip(UnRar): def list(self, password=None): command = "l" if self.fullpath else "l" - p = self.call_cmd(command, self.target, password=password) + p = self.call_cmd(command, fs_encode(self.filename), password=password) out, err = p.communicate() if "Can not open" in err: diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 188fc88bb..220dd6365 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -8,7 +8,7 @@ from string import digits from subprocess import Popen, PIPE from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError -from module.utils import fs_decode, save_join +from module.utils import fs_decode, fs_encode, save_join def renice(pid, value): @@ -89,7 +89,7 @@ class UnRar(Extractor): def test(self, password): - p = self.call_cmd("t", "-v", self.target, password=password) + p = self.call_cmd("t", "-v", fs_encode(self.filename), password=password) self._progress(p) err = p.stderr.read().strip() @@ -101,7 +101,7 @@ class UnRar(Extractor): def check(self, password): - p = self.call_cmd("l", "-v", self.target, password=password) + p = self.call_cmd("l", "-v", fs_encode(self.filename), password=password) out, err = p.communicate() if self.re_wrongpwd.search(err): @@ -117,7 +117,7 @@ class UnRar(Extractor): def repair(self): - p = self.call_cmd("rc", self.target) + p = self.call_cmd("rc", fs_encode(self.filename)) # communicate and retrieve stderr self._progress(p) @@ -149,7 +149,7 @@ class UnRar(Extractor): def extract(self, password=None): command = "x" if self.fullpath else "e" - p = self.call_cmd(command, self.target, self.out, password=password) + p = self.call_cmd(command, fs_encode(self.filename), self.out, password=password) renice(p.pid, self.renice) @@ -189,7 +189,7 @@ class UnRar(Extractor): def list(self, password=None): command = "vb" if self.fullpath else "lb" - p = self.call_cmd(command, "-v", self.target, password=password) + p = self.call_cmd(command, "-v", fs_encode(self.filename), password=password) out, err = p.communicate() if "Cannot open" in err: diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py index dd57a54a7..d95afbc70 100644 --- a/module/plugins/internal/UnZip.py +++ b/module/plugins/internal/UnZip.py @@ -7,6 +7,7 @@ import sys import zipfile from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError +from module.utils import fs_encode class UnZip(Extractor): @@ -28,7 +29,7 @@ class UnZip(Extractor): def list(self, password=None): - with zipfile.ZipFile(self.target, 'r', allowZip64=True) as z: + with zipfile.ZipFile(fs_encode(self.filename), 'r', allowZip64=True) as z: z.setpassword(password) return z.namelist() @@ -38,7 +39,7 @@ class UnZip(Extractor): def test(self): - with zipfile.ZipFile(self.target, 'r', allowZip64=True) as z: + with zipfile.ZipFile(fs_encode(self.filename), 'r', allowZip64=True) as z: badfile = z.testzip() if badfile: @@ -49,7 +50,7 @@ class UnZip(Extractor): def extract(self, password=None): try: - with zipfile.ZipFile(self.target, 'r', allowZip64=True) as z: + with zipfile.ZipFile(fs_encode(self.filename), 'r', allowZip64=True) as z: z.setpassword(password) badfile = z.testzip() -- cgit v1.2.3 From 3551cd44c7fad9cf5159d5920b6e8ec7aa3d1b9b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 7 Mar 2015 18:33:23 +0100 Subject: Spare code cosmetics --- module/plugins/internal/SevenZip.py | 9 ++++----- module/plugins/internal/UnRar.py | 14 +++++++------- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index b5b113566..82901f8cc 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -2,8 +2,7 @@ import os import re - -from subprocess import Popen, PIPE +import subprocess from module.plugins.internal.UnRar import ArchiveError, CRCError, PasswordError, UnRar, renice from module.utils import fs_encode, save_join @@ -41,10 +40,10 @@ class SevenZip(UnRar): def isUsable(cls): if os.name == "nt": cls.CMD = os.path.join(pypath, "7z.exe") - p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) + p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out,err = p.communicate() else: - p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) + p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() m = cls.re_version.search(out) @@ -150,5 +149,5 @@ class SevenZip(UnRar): self.manager.logDebug(" ".join(call)) - p = Popen(call, stdout=PIPE, stderr=PIPE) + p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return p diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 220dd6365..baa5d3115 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -2,10 +2,10 @@ import os import re +import subprocess from glob import glob from string import digits -from subprocess import Popen, PIPE from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError from module.utils import fs_decode, fs_encode, save_join @@ -14,7 +14,7 @@ from module.utils import fs_decode, fs_encode, save_join def renice(pid, value): if value and os.name != "nt": try: - Popen(["renice", str(value), str(pid)], stdout=PIPE, stderr=PIPE, bufsize=-1) + subprocess.Popen(["renice", str(value), str(pid)], stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1) except Exception: pass @@ -52,24 +52,24 @@ class UnRar(Extractor): if os.name == "nt": try: cls.CMD = os.path.join(pypath, "RAR.exe") - p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) + p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() cls.__name__ = "RAR" cls.REPAIR = True except OSError: cls.CMD = os.path.join(pypath, "UnRAR.exe") - p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) + p = Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() else: try: - p = Popen(["rar"], stdout=PIPE, stderr=PIPE) + p = Popen(["rar"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() cls.__name__ = "RAR" cls.REPAIR = True except OSError: #: fallback to unrar - p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) + p = Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() m = cls.re_version.search(out) @@ -244,5 +244,5 @@ class UnRar(Extractor): self.manager.logDebug(" ".join(call)) - p = Popen(call, stdout=PIPE, stderr=PIPE) + p = Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return p -- cgit v1.2.3 From 89b5cafa4e435d1b42b6bbfadd6c5c38dc9ab970 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 9 Mar 2015 17:28:34 +0100 Subject: [UnRar] Fix https://github.com/pyload/pyload/issues/1234 --- module/plugins/internal/UnRar.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index baa5d3115..45e1640bf 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -22,7 +22,7 @@ def renice(pid, value): class UnRar(Extractor): __name__ = "UnRar" - __version__ = "1.15" + __version__ = "1.16" __description__ = """Rar extractor plugin""" __license__ = "GPLv3" @@ -59,17 +59,17 @@ class UnRar(Extractor): except OSError: cls.CMD = os.path.join(pypath, "UnRAR.exe") - p = Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() else: try: - p = Popen(["rar"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.Popen(["rar"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() cls.__name__ = "RAR" cls.REPAIR = True except OSError: #: fallback to unrar - p = Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() m = cls.re_version.search(out) @@ -244,5 +244,5 @@ class UnRar(Extractor): self.manager.logDebug(" ".join(call)) - p = Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return p -- cgit v1.2.3 From 2d302677064dd5996add552ee214093c6d73acea Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 9 Mar 2015 18:20:24 +0100 Subject: Rename fileUrl to getFileURL --- module/plugins/internal/SimpleDereferer.py | 6 +++--- module/plugins/internal/SimpleHoster.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SimpleDereferer.py b/module/plugins/internal/SimpleDereferer.py index bd00f5d25..577d56f75 100644 --- a/module/plugins/internal/SimpleDereferer.py +++ b/module/plugins/internal/SimpleDereferer.py @@ -5,13 +5,13 @@ import re from urllib import unquote from module.plugins.Crypter import Crypter -from module.plugins.internal.SimpleHoster import fileUrl, set_cookies +from module.plugins.internal.SimpleHoster import getFileURL, set_cookies class SimpleDereferer(Crypter): __name__ = "SimpleDereferer" __type__ = "crypter" - __version__ = "0.07" + __version__ = "0.08" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -45,7 +45,7 @@ class SimpleDereferer(Crypter): def decrypt(self, pyfile): - link = fileUrl(self, pyfile.url) + link = getFileURL(self, pyfile.url) if not link: try: diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index e4ff1a2d8..0adfc64b3 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -141,7 +141,7 @@ def timestamp(): #@TODO: Move to hoster class in 0.4.10 -def fileUrl(self, url, follow_location=None): +def getFileURL(self, url, follow_location=None): link = "" redirect = 1 @@ -246,7 +246,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.15" + __version__ = "1.16" __pattern__ = r'^unmatchable$' @@ -311,7 +311,7 @@ class SimpleHoster(Hoster): LOGIN_ACCOUNT = False #: Set to True to require account login DISPOSITION = True #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 - directLink = fileUrl #@TODO: Remove in 0.4.10 + directLink = getFileURL #@TODO: Remove in 0.4.10 @classmethod @@ -349,7 +349,7 @@ class SimpleHoster(Hoster): info['error'] = "missing url" info['status'] = 1 - elif info['status'] is 3 and not fileUrl(None, url): + elif info['status'] is 3 and not getFileURL(None, url): try: html = getURL(url, cookies=cls.COOKIES, decode=not cls.TEXT_ENCODING) -- cgit v1.2.3 From 29dec4b608c8d2df3a4b963d17e652d20381b1b0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 9 Mar 2015 22:45:21 +0100 Subject: [MultiHook] No freezes + better list error handling --- module/plugins/internal/MultiHook.py | 40 ++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 652443098..7e6462d9d 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -11,7 +11,7 @@ from module.utils import decode, remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.37" + __version__ = "0.38" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), @@ -27,7 +27,7 @@ class MultiHook(Hook): ("Walter Purcaro", "vuolter@gmail.com")] - MIN_INTERVAL = 1 * 60 * 60 + MIN_INTERVAL = 1 * 60 * 60 #: 1 hour DOMAIN_REPLACEMENTS = [(r'180upload\.com' , "hundredeightyupload.com"), (r'1fichier\.com' , "onefichier.com" ), @@ -119,17 +119,17 @@ class MultiHook(Hook): if self.plugins: return self.plugins - for _i in xrange(3): + for _i in xrange(2): try: pluginset = self._pluginSet(self.getHosters() if self.plugintype == "hoster" else self.getCrypters()) + break except Exception, e: - self.logError(e, "Waiting 1 minute and retry") + self.logDebug(e, "Waiting 1 minute and retry") sleep(60) - - else: - break else: + self.logWarning(_("Fallback to default reload interval due plugin")) + self.interval = self.MIN_INTERVAL return list() try: @@ -181,8 +181,28 @@ class MultiHook(Hook): raise NotImplementedError + #: Threaded _periodical, remove in 0.4.10 and use built-in flag for that + def _periodical(self): + try: + if self.isActivated(): + self.periodical() + + except Exception, e: + self.core.log.error(_("Error executing hooks: %s") % str(e)) + if self.core.debug: + print_exc() + + self.cb = self.core.scheduler.addJob(self.interval, self._periodical) + + def periodical(self): """reload plugin list periodically""" + if self.getConfig("reload", True): + self.interval = max(self.getConfig("reloadinterval", 12) * 60 * 60, self.MIN_INTERVAL) + else: + self.core.scheduler.removeJob(self.cb) + self.cb = None + self.logInfo(_("Reloading supported %s list") % self.plugintype) old_supported = self.supported @@ -200,12 +220,6 @@ class MultiHook(Hook): for plugin in old_supported: self.unloadPlugin(plugin) - if self.getConfig("reload", True): - self.interval = max(self.getConfig("reloadinterval", 12) * 60 * 60, self.MIN_INTERVAL) - else: - self.core.scheduler.removeJob(self.cb) - self.cb = None - def overridePlugins(self): excludedList = [] -- cgit v1.2.3 From f85e28e565a1e0a76e6271d0b0853d6d48b4a043 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 10 Mar 2015 01:16:29 +0100 Subject: [MultiHook] Fix _pluginSet (fix LinkdecrypterCom issue) --- module/plugins/internal/MultiHook.py | 48 +++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 7e6462d9d..e69f56c32 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -11,7 +11,7 @@ from module.utils import decode, remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.38" + __version__ = "0.39" __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), @@ -23,16 +23,13 @@ class MultiHook(Hook): __description__ = """Hook plugin for multi hoster/crypter""" __license__ = "GPLv3" - __authors__ = [("pyLoad Team", "admin@pyload.org"), + __authors__ = [("pyLoad Team" , "admin@pyload.org" ), ("Walter Purcaro", "vuolter@gmail.com")] - MIN_INTERVAL = 1 * 60 * 60 #: 1 hour + MIN_RELOAD_INTERVAL = 1 * 60 * 60 #: 1 hour DOMAIN_REPLACEMENTS = [(r'180upload\.com' , "hundredeightyupload.com"), - (r'1fichier\.com' , "onefichier.com" ), - (r'2shared\.com' , "twoshared.com" ), - (r'4shared\.com' , "fourshared.com" ), (r'bayfiles\.net' , "bayfiles.com" ), (r'cloudnator\.com' , "shragle.com" ), (r'dfiles\.eu' , "depositfiles.com" ), @@ -48,7 +45,16 @@ class MultiHook(Hook): (r'uploaded\.net' , "uploaded.to" ), (r'uploadhero\.co' , "uploadhero.com" ), (r'zshares\.net' , "zshare.net" ), - (r'(\d+.+)' , "X\1" )] + (r'^1' , "one" ), + (r'^2' , "two" ), + (r'^3' , "three" ), + (r'^4' , "four" ), + (r'^5' , "five" ), + (r'^6' , "six" ), + (r'^7' , "seven" ), + (r'^8' , "eight" ), + (r'^9' , "nine" ), + (r'^0' , "zero" )] def setup(self): @@ -129,7 +135,7 @@ class MultiHook(Hook): sleep(60) else: self.logWarning(_("Fallback to default reload interval due plugin")) - self.interval = self.MIN_INTERVAL + self.interval = self.MIN_RELOAD_INTERVAL return list() try: @@ -152,17 +158,15 @@ class MultiHook(Hook): def _pluginSet(self, plugins): - plugins = set((decode(x).strip().lower() for x in plugins if '.' in x)) + regexp = re.compile(r'^[\w\-.^_]{3,63}\.[a-zA-Z]{2,}$', re.U) + plugins = [decode(p.strip()).lower() for p in plugins if regexp.match(p.strip())] - for rf, rt in self.DOMAIN_REPLACEMENTS: - regex = re.compile(rf) - for p in filter(lambda x: regex.match(x), plugins): - plugins.remove(p) - plugins.add(re.sub(rf, rt, p)) + for r in self.DOMAIN_REPLACEMENTS: + rf, rt = r + repr = re.compile(rf, re.I|re.U) + plugins = [re.sub(rf, rt, p) if repr.match(p) else p for p in plugins] - plugins.discard('') - - return plugins + return set(plugins) def getHosters(self): @@ -198,7 +202,7 @@ class MultiHook(Hook): def periodical(self): """reload plugin list periodically""" if self.getConfig("reload", True): - self.interval = max(self.getConfig("reloadinterval", 12) * 60 * 60, self.MIN_INTERVAL) + self.interval = max(self.getConfig("reloadinterval", 12) * 60 * 60, self.MIN_RELOAD_INTERVAL) else: self.core.scheduler.removeJob(self.cb) self.cb = None @@ -263,7 +267,7 @@ class MultiHook(Hook): self.logDebug("New %ss: %s" % (self.plugintype, ", ".join(plugins))) # create new regexp - regexp = r'.*(?P%s).*' % "|".join([x.replace(".", "\.") for x in plugins]) + regexp = r'.*(?P%s).*' % "|".join(x.replace('.', '\.') for x in plugins) if hasattr(self.pluginclass, "__pattern__") and isinstance(self.pluginclass.__pattern__, basestring) and '://' in self.pluginclass.__pattern__: regexp = r'%s|%s' % (self.pluginclass.__pattern__, regexp) @@ -277,11 +281,11 @@ class MultiHook(Hook): def unloadPlugin(self, plugin): hdict = self.core.pluginManager.plugins[self.plugintype][plugin] if "module" in hdict: - del hdict['module'] + hdict.pop('module', None) if "new_module" in hdict: - del hdict['new_module'] - del hdict['new_name'] + hdict.pop('new_module', None) + hdict.pop('new_name', None) def unload(self): -- cgit v1.2.3 From 7beb65e991bc6d1913c3b5bb2ef69e659d5b8342 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 10 Mar 2015 01:55:52 +0100 Subject: Spare code cosmetics --- module/plugins/internal/Extractor.py | 6 +++--- module/plugins/internal/SevenZip.py | 4 ++-- module/plugins/internal/SimpleCrypter.py | 6 +++--- module/plugins/internal/SimpleHoster.py | 10 +++++----- module/plugins/internal/UnRar.py | 6 +++--- module/plugins/internal/XFSAccount.py | 4 ++-- module/plugins/internal/XFSHoster.py | 8 ++++---- 7 files changed, 22 insertions(+), 22 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 4b21cc49c..79864818e 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -23,9 +23,9 @@ class Extractor: __description__ = """Base extractor plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "ranan@pyload.org"), + __authors__ = [("RaNaN" , "ranan@pyload.org" ), ("Walter Purcaro", "vuolter@gmail.com"), - ("Immenz", "immenz@gmx.net")] + ("Immenz" , "immenz@gmx.net" )] EXTENSIONS = [] @@ -40,7 +40,7 @@ class Extractor: @classmethod - def isMultipart(cls,filename): + def isMultipart(cls, filename): return False diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index 82901f8cc..482b1802c 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -14,7 +14,7 @@ class SevenZip(UnRar): __description__ = """7-Zip extractor plugin""" __license__ = "GPLv3" - __authors__ = [("Michael Nowak", ""), + __authors__ = [("Michael Nowak" , "" ), ("Walter Purcaro", "vuolter@gmail.com")] @@ -41,7 +41,7 @@ class SevenZip(UnRar): if os.name == "nt": cls.CMD = os.path.join(pypath, "7z.exe") p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out,err = p.communicate() + out, err = p.communicate() else: p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 856b548f0..696cc0848 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -20,9 +20,9 @@ class SimpleCrypter(Crypter, SimpleHoster): __description__ = """Simple decrypter plugin""" __license__ = "GPLv3" - __authors__ = [("stickell", "l.stickell@yahoo.it"), - ("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("stickell" , "l.stickell@yahoo.it"), + ("zoidberg" , "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com" )] """ diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 0adfc64b3..df6e78485 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -153,11 +153,11 @@ def getFileURL(self, url, follow_location=None): for i in xrange(redirect): try: self.logDebug("Redirect #%d to: %s" % (i, url)) - header = self.load(url, ref=True, cookies=True, just_header=True, decode=True) + header = self.load(url, just_header=True, decode=True) except Exception: #: Bad bad bad... req = pyreq.getHTTPRequest() - res = req.load(url, cookies=True, just_header=True, decode=True) + res = req.load(url, just_header=True, decode=True) req.close() @@ -252,9 +252,9 @@ class SimpleHoster(Hoster): __description__ = """Simple hoster plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"), + ("stickell" , "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com" )] """ diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 45e1640bf..2ba6ff90d 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -26,9 +26,9 @@ class UnRar(Extractor): __description__ = """Rar extractor plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "RaNaN@pyload.org"), + __authors__ = [("RaNaN" , "RaNaN@pyload.org" ), ("Walter Purcaro", "vuolter@gmail.com"), - ("Immenz", "immenz@gmx.net"),] + ("Immenz" , "immenz@gmx.net" )] CMD = "unrar" @@ -79,7 +79,7 @@ class UnRar(Extractor): @classmethod - def isMultipart(cls,filename): + def isMultipart(cls, filename): multipart = cls.re_multipart.search(filename) if multipart: # First Multipart file (part1.rar for *.part1-9.rar format or *.rar for .r1-9 format) handled as normal Archive diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 845ea3230..9315fb68f 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -16,8 +16,8 @@ class XFSAccount(Account): __description__ = """XFileSharing account plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com" )] HOSTER_DOMAIN = None diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index c4fc969ba..e0c6d8824 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -22,9 +22,9 @@ class XFSHoster(SimpleHoster): __description__ = """XFileSharing hoster plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com")] + __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"), + ("stickell" , "l.stickell@yahoo.it"), + ("Walter Purcaro", "vuolter@gmail.com" )] HOSTER_DOMAIN = None @@ -103,7 +103,7 @@ class XFSHoster(SimpleHoster): self.req.http.c.setopt(FOLLOWLOCATION, 0) - self.html = self.load(pyfile.url, post=data, ref=True, decode=True) + self.html = self.load(pyfile.url, post=data, decode=True) self.req.http.c.setopt(FOLLOWLOCATION, 1) -- cgit v1.2.3 From cfd5dcb231d55478442c7b80517064b377eda43d Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 10 Mar 2015 03:01:47 +0100 Subject: [RapidgatorNet] Fix https://github.com/pyload/pyload/issues/1237 --- module/plugins/internal/SimpleHoster.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index df6e78485..2754b0b18 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -237,7 +237,7 @@ def secondsToMidnight(gmt=0): if hasattr(td, 'total_seconds'): res = td.total_seconds() - else: #@NOTE: work-around for python 2.5 and 2.6 missing timedelta.total_seconds + else: #: work-around for python 2.5 and 2.6 missing timedelta.total_seconds res = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6 return int(res) @@ -246,7 +246,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.16" + __version__ = "1.17" __pattern__ = r'^unmatchable$' @@ -537,8 +537,22 @@ class SimpleHoster(Hoster): elif hasattr(self, 'ERROR_PATTERN'): m = re.search(self.ERROR_PATTERN, self.html) if m: - errmsg = self.info['error'] = m.group(1) - self.error(errmsg) + errmsg + try: + errmsg = m.group(1) + except Exception: + errmsg = m.group(0) + + self.info['error'] = errmsg + + if "hour" in errmsg + self.wait(secondsToMidnight(gmt=2), True) + + elif re.search("da(il)?y|today", errmsg): + self.wait(1 * 60 * 60, True) + + else: + self.error(errmsg) elif hasattr(self, 'WAIT_PATTERN'): m = re.search(self.WAIT_PATTERN, self.html) @@ -546,7 +560,6 @@ class SimpleHoster(Hoster): wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in re.findall(r'(\d+)\s*(hr|hour|min|sec)', m.group(0), re.I)) self.wait(wait_time, wait_time > 300) - return self.info.pop('error', None) -- cgit v1.2.3 From 3e81879d0c472c1079e75a12c7a8584f8304a8db Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 10 Mar 2015 03:35:47 +0100 Subject: [SimpleHoster] Fixup --- module/plugins/internal/SimpleHoster.py | 14 +++++++++----- module/plugins/internal/XFSHoster.py | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 2754b0b18..4777d0641 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.17" + __version__ = "1.18" __pattern__ = r'^unmatchable$' @@ -537,11 +537,10 @@ class SimpleHoster(Hoster): elif hasattr(self, 'ERROR_PATTERN'): m = re.search(self.ERROR_PATTERN, self.html) if m: - errmsg try: - errmsg = m.group(1) + errmsg = m.group(1).strip() except Exception: - errmsg = m.group(0) + errmsg = m.group(0).strip() self.info['error'] = errmsg @@ -557,8 +556,13 @@ class SimpleHoster(Hoster): elif hasattr(self, 'WAIT_PATTERN'): m = re.search(self.WAIT_PATTERN, self.html) if m: + try: + waitmsg = m.group(1).strip() + except Exception: + waitmsg = m.group(0).strip() + wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in - re.findall(r'(\d+)\s*(hr|hour|min|sec)', m.group(0), re.I)) + re.findall(r'(\d+)\s*(hr|hour|min|sec)', waitmsg, re.I)) self.wait(wait_time, wait_time > 300) self.info.pop('error', None) diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index e0c6d8824..6e0b5e4ab 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -16,7 +16,7 @@ from module.utils import html_unescape class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.44" + __version__ = "0.45" __pattern__ = r'^unmatchable$' @@ -195,7 +195,7 @@ class XFSHoster(SimpleHoster): if 'wait' in self.errmsg: wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in re.findall(r'(\d+)\s*(hr|hour|min|sec)', self.errmsg, re.I)) - self.wait(wait_time, True) + self.wait(wait_time, wait_time > 300) elif 'country' in self.errmsg: self.fail(_("Downloads are disabled for your country")) -- cgit v1.2.3 From badb1317968331206d409ec8abf0c40ffc980bf8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 10 Mar 2015 03:56:31 +0100 Subject: [SimpleHoster] Fix https://github.com/pyload/pyload/issues/1242 --- module/plugins/internal/SimpleHoster.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 4777d0641..b2c40a828 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.18" + __version__ = "1.19" __pattern__ = r'^unmatchable$' @@ -544,7 +544,7 @@ class SimpleHoster(Hoster): self.info['error'] = errmsg - if "hour" in errmsg + if "hour" in errmsg: self.wait(secondsToMidnight(gmt=2), True) elif re.search("da(il)?y|today", errmsg): -- cgit v1.2.3 From 58e98ab99bd7672492109786c4db7076d231631b Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 10 Mar 2015 15:32:24 +0100 Subject: [FileSharkPl] Fix https://github.com/pyload/pyload/issues/1040 (2) --- module/plugins/internal/SimpleHoster.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index b2c40a828..3a38c4eea 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.19" + __version__ = "1.20" __pattern__ = r'^unmatchable$' @@ -516,6 +516,9 @@ class SimpleHoster(Hoster): if hasattr(self, 'ERROR_PATTERN'): rules['error'] = re.compile(self.ERROR_PATTERN) + if hasattr(self, 'WAIT_PATTERN'): + rules['wait error'] = re.compile(self.WAIT_PATTERN) + check = self.checkDownload(rules) if check: #@TODO: Move to hoster in 0.4.10 errmsg = check.strip().capitalize() -- cgit v1.2.3 From ebb9910a25dbf0fc0d16242e9b4e9ffaa418656e Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 10 Mar 2015 20:01:17 +0100 Subject: [SimpleHoster] Improve checkFile routine --- module/plugins/internal/SimpleHoster.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 3a38c4eea..ac25423fc 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.20" + __version__ = "1.21" __pattern__ = r'^unmatchable$' @@ -499,7 +499,7 @@ class SimpleHoster(Hoster): self.download(link, ref=False, disposition=disposition) - def checkFile(self): + def checkFile(self, rules={}): if self.cTask and not self.lastDownload: self.invalidCaptcha() self.retry(10, reason=_("Wrong captcha")) @@ -509,24 +509,28 @@ class SimpleHoster(Hoster): self.error(self.pyfile.error or _("No file downloaded")) else: - rules = {'empty file': re.compile(r'\A\Z'), - 'html file' : re.compile(r'\A\s*)?\d{3}(\Z|\s+)')} + errmsg = self.checkDownload({'Empty file': re.compile(r'\A\s*\Z')}) - if hasattr(self, 'ERROR_PATTERN'): - rules['error'] = re.compile(self.ERROR_PATTERN) + if errmsg: + self.lastDownload = "" + else: + for r, p in [('html file' , re.compile(r'\A\s*)?\d{3}(\Z|\s+)'))]: + if r not in rules: + rules[r] = p - if hasattr(self, 'WAIT_PATTERN'): - rules['wait error'] = re.compile(self.WAIT_PATTERN) + for r, a in [('error' , 'ERROR_PATTERN'), + ('wait error', 'WAIT_PATTERN' )]: + if r not in rules and hasattr(self, a): + rules[r] = getattr(self, a) - check = self.checkDownload(rules) - if check: #@TODO: Move to hoster in 0.4.10 - errmsg = check.strip().capitalize() + errmsg = self.checkDownload(rules, delete=not self.core.debug).strip().capitalize() if self.lastCheck: errmsg += " | " + self.lastCheck.group(0).strip() - self.lastDownload = "" - self.retry(10, 60, errmsg) + if errmsg: + self.logWarning("Bad file", "Waiting 1 minute and retry") + self.retry(3, 60, errmsg) def checkErrors(self): -- cgit v1.2.3 From 7f357700f340db51a0de65a8dcc0726a6965ecd3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 10 Mar 2015 22:37:29 +0100 Subject: [SimpleHoster] Improve checkFile routine (2) --- module/plugins/internal/SimpleHoster.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'module/plugins/internal') 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*)?\d{3}(\Z|\s+)'))]: + if not errmsg: + for r, p in [('Html file' , re.compile(r'\A\s* Date: Tue, 10 Mar 2015 23:05:38 +0100 Subject: [BasePlugin][SimpleHoster] Improve checkDownload rules --- module/plugins/internal/SimpleHoster.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/internal') 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* Date: Wed, 11 Mar 2015 14:22:45 +0100 Subject: [SimpleHoster] Fix https://github.com/pyload/pyload/issues/1248 --- module/plugins/internal/SimpleHoster.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 13a9c134f..a1825a73e 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.23" + __version__ = "1.24" __pattern__ = r'^unmatchable$' @@ -524,16 +524,20 @@ class SimpleHoster(Hoster): if r not in rules and hasattr(self, a): rules[r] = getattr(self, a) - errmsg = self.checkDownload(rules).strip().capitalize() + errmsg = self.checkDownload(rules) - if errmsg: - try: - errmsg += " | " + self.lastCheck.group(1).strip() - except Exception: - pass + if not errmsg: + return + + errmsg = errmsg.strip().capitalize() + + try: + errmsg += " | " + self.lastCheck.group(1).strip() + except Exception: + pass - self.logWarning("Bad file", "Waiting 1 minute and retry") - self.retry(3, 60, errmsg) + self.logWarning("Bad file", "Waiting 1 minute and retry") + self.retry(3, 60, errmsg) def checkErrors(self): -- cgit v1.2.3 From c4719b75e43bed931f79ba763b8e8d81a2318710 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 14 Mar 2015 10:31:05 +0100 Subject: [BasePlugin][SimpleHoster] Better checkDownload warning --- module/plugins/internal/SimpleHoster.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index a1825a73e..114128c63 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.24" + __version__ = "1.25" __pattern__ = r'^unmatchable$' @@ -514,7 +514,7 @@ class SimpleHoster(Hoster): if not errmsg: for r, p in [('Html file' , re.compile(r'\A\s* Date: Sat, 14 Mar 2015 11:07:54 +0100 Subject: Import cleanup for datetime and time modules --- module/plugins/internal/MultiHook.py | 5 ++--- module/plugins/internal/SimpleHoster.py | 12 ++++++------ module/plugins/internal/XFSAccount.py | 6 +++--- module/plugins/internal/XFSHoster.py | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index e69f56c32..d4369da9b 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -1,8 +1,7 @@ # -*- coding: utf-8 -*- import re - -from time import sleep +import time from module.plugins.Hook import Hook from module.utils import decode, remove_chars @@ -132,7 +131,7 @@ class MultiHook(Hook): except Exception, e: self.logDebug(e, "Waiting 1 minute and retry") - sleep(60) + time.sleep(60) else: self.logWarning(_("Fallback to default reload interval due plugin")) self.interval = self.MIN_RELOAD_INTERVAL diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 114128c63..5defd028d 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- +import datetime import mimetypes import os import re +import time -from datetime import datetime, timedelta from inspect import isclass -from time import time from urllib import unquote from urlparse import urljoin, urlparse @@ -137,7 +137,7 @@ def create_getInfo(plugin): def timestamp(): - return int(time() * 1000) + return int(time.time() * 1000) #@TODO: Move to hoster class in 0.4.10 @@ -226,18 +226,18 @@ def getFileURL(self, url, follow_location=None): def secondsToMidnight(gmt=0): - now = datetime.utcnow() + timedelta(hours=gmt) + now = datetime.datetime.utcnow() + datetime.timedelta(hours=gmt) if now.hour is 0 and now.minute < 10: midnight = now else: - midnight = now + timedelta(days=1) + midnight = now + datetime.timedelta(days=1) td = midnight.replace(hour=0, minute=10, second=0, microsecond=0) - now if hasattr(td, 'total_seconds'): res = td.total_seconds() - else: #: work-around for python 2.5 and 2.6 missing timedelta.total_seconds + else: #: work-around for python 2.5 and 2.6 missing datetime.timedelta.total_seconds res = (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6 return int(res) diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 9315fb68f..31d1b7e2f 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- import re +import time -from time import gmtime, mktime, strptime from urlparse import urljoin from module.plugins.Account import Account @@ -80,7 +80,7 @@ class XFSAccount(Account): self.logDebug("Expire date: " + expiredate) try: - validuntil = mktime(strptime(expiredate, "%d %B %Y")) + validuntil = time.mktime(time.strptime(expiredate, "%d %B %Y")) except Exception, e: self.logError(e) @@ -88,7 +88,7 @@ class XFSAccount(Account): else: self.logDebug("Valid until: %s" % validuntil) - if validuntil > mktime(gmtime()): + if validuntil > time.mktime(time.gmtime()): premium = True trafficleft = -1 else: diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 6e0b5e4ab..9e60a5aa5 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- import re +import time from random import random -from time import sleep from urlparse import urljoin, urlparse from pycurl import FOLLOWLOCATION, LOW_SPEED_TIME -- cgit v1.2.3 From 2bc144adb6bc2759b635e09687b27bf96074827f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 18 Mar 2015 13:39:07 +0100 Subject: Spare code cosmetics --- module/plugins/internal/Extractor.py | 3 +-- module/plugins/internal/MultiHook.py | 2 ++ module/plugins/internal/SimpleCrypter.py | 6 ++---- module/plugins/internal/SimpleHoster.py | 4 +--- 4 files changed, 6 insertions(+), 9 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 79864818e..f32329e37 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -23,8 +23,7 @@ class Extractor: __description__ = """Base extractor plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN" , "ranan@pyload.org" ), - ("Walter Purcaro", "vuolter@gmail.com"), + __authors__ = [("Walter Purcaro", "vuolter@gmail.com"), ("Immenz" , "immenz@gmx.net" )] diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index d4369da9b..35bb9c65d 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -57,6 +57,8 @@ class MultiHook(Hook): def setup(self): + self.info = {} #@TODO: Remove in 0.4.10 + self.plugins = [] self.supported = [] self.new_supported = [] diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index 696cc0848..ef6d3fc0e 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -15,14 +15,12 @@ class SimpleCrypter(Crypter, SimpleHoster): __version__ = "0.43" __pattern__ = r'^unmatchable$' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config['general']['folder_per_package'] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides core.config['general']['folder_per_package'] ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] __description__ = """Simple decrypter plugin""" __license__ = "GPLv3" - __authors__ = [("stickell" , "l.stickell@yahoo.it"), - ("zoidberg" , "zoidberg@mujmail.cz"), - ("Walter Purcaro", "vuolter@gmail.com" )] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com" )] """ diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 5defd028d..103dc9a19 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -252,9 +252,7 @@ class SimpleHoster(Hoster): __description__ = """Simple hoster plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg" , "zoidberg@mujmail.cz"), - ("stickell" , "l.stickell@yahoo.it"), - ("Walter Purcaro", "vuolter@gmail.com" )] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com" )] """ -- cgit v1.2.3 From edd7019034e191a754211a2a949b449b2d40ed3c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 18 Mar 2015 22:15:54 +0100 Subject: [SimpleHoster] retryFree feature --- module/plugins/internal/SimpleHoster.py | 63 +++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 23 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 103dc9a19..54872a088 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -15,7 +15,7 @@ from module.network.CookieJar import CookieJar from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL from module.plugins.Hoster import Hoster -from module.plugins.Plugin import Fail +from module.plugins.Plugin import Fail, Retry from module.utils import fixup, fs_encode, parseFileSize @@ -246,9 +246,10 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.25" + __version__ = "1.26" __pattern__ = r'^unmatchable$' + __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Simple hoster plugin""" __license__ = "GPLv3" @@ -424,6 +425,9 @@ class SimpleHoster(Hoster): self.directDL = False #@TODO: Move to hoster class in 0.4.10 self.multihost = False #@TODO: Move to hoster class in 0.4.10 + if not self.getConfig('use_premium', True): + self.retryFree() + if self.LOGIN_ACCOUNT and not self.account: self.fail(_("Required account not found")) @@ -454,35 +458,42 @@ class SimpleHoster(Hoster): def process(self, pyfile): - self.prepare() - self.checkInfo() + try: + self.prepare() + self.checkInfo() + + if self.directDL: + self.logDebug("Looking for direct download link...") + self.handleDirect(pyfile) - if self.directDL: - self.logDebug("Looking for direct download link...") - self.handleDirect(pyfile) + if self.multihost and not self.link and not self.lastDownload: + self.logDebug("Looking for leeched download link...") + self.handleMulti(pyfile) - if self.multihost and not self.link and not self.lastDownload: - self.logDebug("Looking for leeched download link...") - self.handleMulti(pyfile) + if not self.link and not self.lastDownload: + self.MULTI_HOSTER = False + self.retry(1, reason="Multi hoster fails") if not self.link and not self.lastDownload: - self.MULTI_HOSTER = False - self.retry(1, reason="Multi hoster fails") + self.preload() + self.checkInfo() - if not self.link and not self.lastDownload: - self.preload() - self.checkInfo() + if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): + self.logDebug("Handled as premium download") + self.handlePremium(pyfile) - if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): - self.logDebug("Handled as premium download") - self.handlePremium(pyfile) + elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): + self.logDebug("Handled as free download") + self.handleFree(pyfile) - elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): - self.logDebug("Handled as free download") - self.handleFree(pyfile) + self.downloadLink(self.link, self.DISPOSITION) #: Remove `self.DISPOSITION` in 0.4.10 + self.checkFile() - self.downloadLink(self.link, self.DISPOSITION) #: Remove `self.DISPOSITION` in 0.4.10 - self.checkFile() + except Fail, e: #@TODO: Move to PluginThread in 0.4.10 + if self.premium: + self.retryFree() + else: + raise Fail(e) def downloadLink(self, link, disposition=True): @@ -721,6 +732,12 @@ class SimpleHoster(Hoster): return size <= traffic + def retryFree(self): + self.account = None + self.req = self.core.requestFactory.getRequest(self.__name__) + raise Retry(_("Fallback to free download")) + + #@TODO: Remove in 0.4.10 def wait(self, seconds=0, reconnect=None): return _wait(self, seconds, reconnect) -- cgit v1.2.3 From e19feb3a3b961d3e1f1a86f2366c3b71c85bc8db Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 18 Mar 2015 22:16:38 +0100 Subject: [MultiHoster] Fix revertfailed feature --- module/plugins/internal/MultiHook.py | 41 ++++----------------- module/plugins/internal/MultiHoster.py | 66 ++++++++++++++++++++++++---------- 2 files changed, 54 insertions(+), 53 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 35bb9c65d..9ba1fc2c8 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -10,15 +10,12 @@ from module.utils import decode, remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.39" + __version__ = "0.40" - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed" , "bool" , "Revert to standard download if fails", True ), - ("retry" , "int" , "Number of retries before revert" , 10 ), - ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Hook plugin for multi hoster/crypter""" __license__ = "GPLv3" @@ -135,7 +132,7 @@ class MultiHook(Hook): self.logDebug(e, "Waiting 1 minute and retry") time.sleep(60) else: - self.logWarning(_("Fallback to default reload interval due plugin")) + self.logWarning(_("Fallback to default reload interval due plugin parse error")) self.interval = self.MIN_RELOAD_INTERVAL return list() @@ -299,29 +296,3 @@ class MultiHook(Hook): hdict['pattern'] = getattr(self.pluginclass, "__pattern__", r'^unmatchable$') hdict['re'] = re.compile(hdict['pattern']) - - - def downloadFailed(self, pyfile): - """remove plugin override if download fails but not if file is offline/temp.offline""" - if pyfile.status != 8 or not self.getConfig("revertfailed", True): - return - - hdict = self.core.pluginManager.plugins[self.plugintype][pyfile.pluginname] - if "new_name" in hdict and hdict['new_name'] == self.pluginname: - if pyfile.error == "MultiHook": - self.logDebug("Unload MultiHook", pyfile.pluginname, hdict) - self.unloadPlugin(pyfile.pluginname) - pyfile.setStatus("queued") - pyfile.sync() - else: - retries = max(self.getConfig("retry", 10), 0) - wait_time = max(self.getConfig("retryinterval", 1), 0) - - if 0 < retries > pyfile.plugin.retries: - self.logInfo(_("Retrying: %s") % pyfile.name) - pyfile.setCustomStatus("MultiHook", "queued") - pyfile.sync() - - pyfile.plugin.retries += 1 - pyfile.plugin.setWait(wait_time) - pyfile.plugin.wait() diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index 63b7d76b1..fb76c58f4 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -2,15 +2,18 @@ import re +from module.plugins.Plugin import Fail, Retry from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, replace_patterns, set_cookies class MultiHoster(SimpleHoster): __name__ = "MultiHoster" __type__ = "hoster" - __version__ = "0.37" + __version__ = "0.38" __pattern__ = r'^unmatchable$' + __config__ = [("use_premium" , "bool", "Use premium account if available" , True), + ("revertfailed", "bool", "Revert to standard download if fails", True)] __description__ = """Multi hoster plugin""" __license__ = "GPLv3" @@ -32,6 +35,9 @@ class MultiHoster(SimpleHoster): self.link = "" #@TODO: Move to hoster class in 0.4.10 self.directDL = False #@TODO: Move to hoster class in 0.4.10 + if not self.getConfig('use_premium', True): + self.retryFree() + if self.LOGIN_ACCOUNT and not self.account: self.fail(_("Required account not found")) @@ -49,29 +55,53 @@ class MultiHoster(SimpleHoster): def process(self, pyfile): - self.prepare() + try: + self.prepare() + + if self.directDL: + self.checkInfo() + self.logDebug("Looking for direct download link...") + self.handleDirect(pyfile) + + if not self.link and not self.lastDownload: + self.preload() + + self.checkErrors() + self.checkStatus(getinfo=False) + + if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): + self.logDebug("Handled as premium download") + self.handlePremium(pyfile) + + elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): + self.logDebug("Handled as free download") + self.handleFree(pyfile) + + self.downloadLink(self.link, True) + self.checkFile() + + except Fail, e: #@TODO: Move to PluginThread in 0.4.10 + if self.premium: + self.retryFree() - if self.directDL: - self.checkInfo() - self.logDebug("Looking for direct download link...") - self.handleDirect(pyfile) + elif self.getConfig("revertfailed", True) \ + and "new_module" in self.core.pluginManager.hosterPlugins[self.__name__]: + hdict = self.core.pluginManager.hosterPlugins[self.__name__] - if not self.link and not self.lastDownload: - self.preload() + tmp_module = hdict['new_module'] + tmp_name = hdict['new_name'] + hdict.pop('new_module', None) + hdict.pop('new_name', None) - self.checkErrors() - self.checkStatus(getinfo=False) + pyfile.initPlugin() - if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): - self.logDebug("Handled as premium download") - self.handlePremium(pyfile) + hdict['new_module'] = tmp_module + hdict['new_name'] = tmp_name - elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): - self.logDebug("Handled as free download") - self.handleFree(pyfile) + raise Retry(_("Revert to original hoster plugin")) - self.downloadLink(self.link, True) - self.checkFile() + else: + raise Fail(e) def handlePremium(self, pyfile): -- cgit v1.2.3 From b4a43ec54dbd327d46692c7425695adc91fff3d7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 18 Mar 2015 23:14:24 +0100 Subject: [SimpleHoster] Fix https://github.com/pyload/pyload/issues/1263 --- module/plugins/internal/MultiHook.py | 2 +- module/plugins/internal/SimpleHoster.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 9ba1fc2c8..ef7f47ed1 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -110,7 +110,7 @@ class MultiHook(Hook): return rep - def getConfig(self, option, default=''): + def getConfig(self, option, default=''): #@TODO: Remove in 0.4.10 """getConfig with default value - sublass may not implements all config options""" try: return self.getConf(option) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 54872a088..1b6b330b6 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.26" + __version__ = "1.27" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -732,6 +732,15 @@ class SimpleHoster(Hoster): return size <= traffic + def getConfig(self, option, default=''): #@TODO: Remove in 0.4.10 + """getConfig with default value - sublass may not implements all config options""" + try: + return self.getConf(option) + + except KeyError: + return default + + def retryFree(self): self.account = None self.req = self.core.requestFactory.getRequest(self.__name__) -- cgit v1.2.3 From e4e743646a20d24077a8f1f95a0e5aa772771ff7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 20 Mar 2015 12:00:54 +0100 Subject: [SimpleHoster] Fix checkErrors --- module/plugins/internal/SimpleHoster.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 1b6b330b6..047d9edde 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.27" + __version__ = "1.28" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -522,7 +522,7 @@ class SimpleHoster(Hoster): '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* Date: Sat, 21 Mar 2015 17:15:08 +0100 Subject: [SimpleHoster] Fix checkErrors (2) --- module/plugins/internal/MultiHoster.py | 3 ++- module/plugins/internal/SimpleHoster.py | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index fb76c58f4..350397f8b 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, r class MultiHoster(SimpleHoster): __name__ = "MultiHoster" __type__ = "hoster" - __version__ = "0.38" + __version__ = "0.39" __pattern__ = r'^unmatchable$' __config__ = [("use_premium" , "bool", "Use premium account if available" , True), @@ -82,6 +82,7 @@ class MultiHoster(SimpleHoster): except Fail, e: #@TODO: Move to PluginThread in 0.4.10 if self.premium: + self.logWarning(_("Premium download failed")) self.retryFree() elif self.getConfig("revertfailed", True) \ diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 047d9edde..8a3381c53 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.28" + __version__ = "1.29" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -491,6 +491,7 @@ class SimpleHoster(Hoster): except Fail, e: #@TODO: Move to PluginThread in 0.4.10 if self.premium: + self.logWarning(_("Premium download failed")) self.retryFree() else: raise Fail(e) @@ -567,15 +568,15 @@ class SimpleHoster(Hoster): self.info['error'] = errmsg - if "min" in errmsg: - self.wait(1 * 60) - - elif "hour" in errmsg: + if "hour" in errmsg: self.wait(1 * 60 * 60, True) elif re.search("da(il)?y|today", errmsg): self.wait(secondsToMidnight(gmt=2), True) + elif "minute" in errmsg: + self.wait(1 * 60) + else: self.error(errmsg) -- cgit v1.2.3 From d0ef13775925f15811d2a6744d29190c313b3820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= Date: Mon, 23 Mar 2015 00:32:56 +0100 Subject: [ExtractArchive] extract archive even if first part is not in package --- module/plugins/internal/Extractor.py | 16 +++++++++++++--- module/plugins/internal/UnRar.py | 5 ++--- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index f32329e37..dad57dc7f 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import os +import re from module.PyFile import PyFile @@ -19,7 +20,7 @@ class PasswordError(Exception): class Extractor: __name__ = "Extractor" - __version__ = "0.21" + __version__ = "0.22" __description__ = """Base extractor plugin""" __license__ = "GPLv3" @@ -35,7 +36,7 @@ class Extractor: @classmethod def isArchive(cls, filename): name = os.path.basename(filename).lower() - return any(name.endswith(ext) for ext in cls.EXTENSIONS) and not cls.isMultipart(filename) + return any(name.endswith(ext) for ext in cls.EXTENSIONS) @classmethod @@ -57,7 +58,16 @@ class Extractor: :param files_ids: List of filepathes :return: List of targets, id tuple list """ - return [(fname, id, fout) for fname, id, fout in files_ids if cls.isArchive(fname)] + targets = [] + processed = [] + + for fname, id, fout in files_ids: + if cls.isArchive(fname): + pname = re.sub(cls.re_multipart, '', fname) if cls.isMultipart(fname) else os.path.splitext(fname)[0] + if pname not in processed: + processed.append(pname) + targets.append((fname, id, fout)) + return targets def __init__(self, manager, filename, out, diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 2ba6ff90d..b75e21f57 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -22,7 +22,7 @@ def renice(pid, value): class UnRar(Extractor): __name__ = "UnRar" - __version__ = "1.16" + __version__ = "1.17" __description__ = """Rar extractor plugin""" __license__ = "GPLv3" @@ -82,8 +82,7 @@ class UnRar(Extractor): def isMultipart(cls, filename): multipart = cls.re_multipart.search(filename) if multipart: - # First Multipart file (part1.rar for *.part1-9.rar format or *.rar for .r1-9 format) handled as normal Archive - return False if (multipart.group(1) == "part" and int(multipart.group(2)) == 1 and not multipart.group(3)) else True + return True if not multipart.group(3) else False return False -- cgit v1.2.3 From 86ad6441ac4f88ab78e8dec6f2ca8879982f6012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= Date: Tue, 24 Mar 2015 18:55:50 +0100 Subject: [ExtractArchive] Bugfix --- module/plugins/internal/UnRar.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index b75e21f57..87cf61a62 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -22,7 +22,7 @@ def renice(pid, value): class UnRar(Extractor): __name__ = "UnRar" - __version__ = "1.17" + __version__ = "1.18" __description__ = """Rar extractor plugin""" __license__ = "GPLv3" @@ -80,11 +80,7 @@ class UnRar(Extractor): @classmethod def isMultipart(cls, filename): - multipart = cls.re_multipart.search(filename) - if multipart: - return True if not multipart.group(3) else False - - return False + return True if cls.re_multipart.search(filename) else False def test(self, password): -- cgit v1.2.3 From f9132006cf8875d5cdcce2bf2432671d529ee584 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 25 Mar 2015 03:11:01 +0100 Subject: [SimpleHoster] Fix retryFree --- module/plugins/internal/SimpleHoster.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 8a3381c53..a42947970 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.29" + __version__ = "1.30" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -746,8 +746,12 @@ class SimpleHoster(Hoster): def retryFree(self): + if not self.premium: + return + self.premium = False self.account = None self.req = self.core.requestFactory.getRequest(self.__name__) + self.retries = 0 raise Retry(_("Fallback to free download")) -- cgit v1.2.3 From ffb46ab200df55303836cc49e61b971b02e67ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= Date: Wed, 25 Mar 2015 18:39:54 +0100 Subject: [ExtractArchive] Send2Trash Integration --- module/plugins/internal/Extractor.py | 4 ++-- module/plugins/internal/UnRar.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index dad57dc7f..ec6a4e175 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -20,7 +20,7 @@ class PasswordError(Exception): class Extractor: __name__ = "Extractor" - __version__ = "0.22" + __version__ = "0.23" __description__ = """Base extractor plugin""" __license__ = "GPLv3" @@ -75,7 +75,7 @@ class Extractor: overwrite=False, excludefiles=[], renice=0, - delete=False, + delete='No', keepbroken=False, fid=None): """ Initialize extractor for specific file """ diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 87cf61a62..75c192bac 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -22,7 +22,7 @@ def renice(pid, value): class UnRar(Extractor): __name__ = "UnRar" - __version__ = "1.18" + __version__ = "1.19" __description__ = """Rar extractor plugin""" __license__ = "GPLv3" @@ -216,7 +216,7 @@ class UnRar(Extractor): args.append("-o+") else: args.append("-o-") - if self.delete: + if self.delete != 'No': args.append("-or") for word in self.excludefiles: -- cgit v1.2.3 From 7d90803262ccbb4fc5296a4dc3ce30fe98f55631 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 25 Mar 2015 23:10:07 +0100 Subject: __config__ cosmetics --- module/plugins/internal/MultiHook.py | 8 ++++---- module/plugins/internal/SimpleCrypter.py | 4 ++-- module/plugins/internal/SimpleDereferer.py | 4 ++-- module/plugins/internal/SimpleHoster.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index ef7f47ed1..5855f7ece 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -12,10 +12,10 @@ class MultiHook(Hook): __type__ = "hook" __version__ = "0.40" - __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), - ("reload" , "bool" , "Reload plugin list" , True ), - ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)", "" ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Hook plugin for multi hoster/crypter""" __license__ = "GPLv3" diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index ef6d3fc0e..9946bb115 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -15,8 +15,8 @@ class SimpleCrypter(Crypter, SimpleHoster): __version__ = "0.43" __pattern__ = r'^unmatchable$' - __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides core.config['general']['folder_per_package'] - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), #: Overrides core.config['general']['folder_per_package'] + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Simple decrypter plugin""" __license__ = "GPLv3" diff --git a/module/plugins/internal/SimpleDereferer.py b/module/plugins/internal/SimpleDereferer.py index 577d56f75..360cd7c30 100644 --- a/module/plugins/internal/SimpleDereferer.py +++ b/module/plugins/internal/SimpleDereferer.py @@ -14,8 +14,8 @@ class SimpleDereferer(Crypter): __version__ = "0.08" __pattern__ = r'^unmatchable$' - __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), - ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] + __config__ = [("use_subfolder" , "bool", "Save package to subfolder" , True), + ("subfolder_per_pack", "bool", "Create a subfolder for each package", True)] __description__ = """Simple dereferer plugin""" __license__ = "GPLv3" diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index a42947970..bcdd1cbef 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -148,7 +148,7 @@ def getFileURL(self, url, follow_location=None): if type(follow_location) is int: redirect = max(follow_location, 1) else: - redirect = 5 + redirect = 10 for i in xrange(redirect): try: @@ -246,7 +246,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.30" + __version__ = "1.31" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available", True)] -- cgit v1.2.3 From 329293e0bb0cf4008688d8c73d4b98caa7082141 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 26 Mar 2015 10:40:32 +0100 Subject: [Extractor] Rename method 'test' to 'verify' --- module/plugins/internal/Extractor.py | 4 ++-- module/plugins/internal/SevenZip.py | 4 ++-- module/plugins/internal/UnRar.py | 4 ++-- module/plugins/internal/UnZip.py | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index ec6a4e175..159b65ffe 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -20,7 +20,7 @@ class PasswordError(Exception): class Extractor: __name__ = "Extractor" - __version__ = "0.23" + __version__ = "0.24" __description__ = """Base extractor plugin""" __license__ = "GPLv3" @@ -109,7 +109,7 @@ class Extractor: """ raise NotImplementedError - def test(self): + def verify(self): """Testing with Extractors buildt-in method Raises error if password is needed, integrity is questionable or else. diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index 482b1802c..624f6c939 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -10,7 +10,7 @@ from module.utils import fs_encode, save_join class SevenZip(UnRar): __name__ = "SevenZip" - __version__ = "0.10" + __version__ = "0.11" __description__ = """7-Zip extractor plugin""" __license__ = "GPLv3" @@ -52,7 +52,7 @@ class SevenZip(UnRar): return True - def test(self, password): + def verify(self, password): # 7z can't distinguish crc and pw error in test p = self.call_cmd("l", "-slt", fs_encode(self.filename)) out, err = p.communicate() diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 75c192bac..5b9f2e1c3 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -22,7 +22,7 @@ def renice(pid, value): class UnRar(Extractor): __name__ = "UnRar" - __version__ = "1.19" + __version__ = "1.20" __description__ = """Rar extractor plugin""" __license__ = "GPLv3" @@ -83,7 +83,7 @@ class UnRar(Extractor): return True if cls.re_multipart.search(filename) else False - def test(self, password): + def verify(self, password): p = self.call_cmd("t", "-v", fs_encode(self.filename), password=password) self._progress(p) err = p.stderr.read().strip() diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py index d95afbc70..8d3fec370 100644 --- a/module/plugins/internal/UnZip.py +++ b/module/plugins/internal/UnZip.py @@ -12,7 +12,7 @@ from module.utils import fs_encode class UnZip(Extractor): __name__ = "UnZip" - __version__ = "1.11" + __version__ = "1.12" __description__ = """Zip extractor plugin""" __license__ = "GPLv3" @@ -38,7 +38,7 @@ class UnZip(Extractor): pass - def test(self): + def verify(self): with zipfile.ZipFile(fs_encode(self.filename), 'r', allowZip64=True) as z: badfile = z.testzip() -- cgit v1.2.3