From 6260e02b65d3be072c8392c3b2e36ef47d215c41 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Tue, 2 Apr 2013 16:52:03 +0200 Subject: Unrar also deletes .r* files --- module/plugins/internal/UnRar.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 240dc0233..ef04f558e 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -28,12 +28,13 @@ from module.plugins.internal.AbstractExtractor import AbtractExtractor, WrongPas class UnRar(AbtractExtractor): __name__ = "UnRar" - __version__ = "0.11" + __version__ = "0.12" # there are some more uncovered rar formats - re_splitfile = re.compile(r"(.*)\.part(\d+)\.rar$") + re_splitfile = re.compile(r"(.*)\.part(\d+)\.rar$", re.I) + re_partfiles = re.compile(r".*\.(rar|r[0-9]+)", re.I) re_filelist = re.compile(r"(.+)\s+(\d+)\s+(\d+)\s+") - re_wrongpwd = re.compile("(Corrupt file or wrong password|password incorrect)") + re_wrongpwd = re.compile("(Corrupt file or wrong password|password incorrect)", re.I) CMD = "unrar" @staticmethod @@ -139,7 +140,9 @@ class UnRar(AbtractExtractor): def getDeleteFiles(self): if ".part" in self.file: return glob(re.sub("(?<=\.part)([01]+)", "*", self.file, re.IGNORECASE)) - return [self.file] + # get files which matches .r* and filter unsuited files out + parts = glob(re.sub(r"(?<=\.r)ar$", "*", self.file, re.IGNORECASE)) + return filter(lambda x: self.re_partfiles.match(x), parts) def listContent(self): command = "vb" if self.fullpath else "lb" -- cgit v1.2.3 From a0308bfa9767895e629c1746e4b9e80313c33237 Mon Sep 17 00:00:00 2001 From: Stefano Date: Tue, 2 Apr 2013 21:45:20 +0200 Subject: SimpleCrypter: decoding loaded html --- module/plugins/internal/SimpleCrypter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index b8942c724..a36df1979 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -22,7 +22,7 @@ from module.plugins.Crypter import Crypter class SimpleCrypter(Crypter): __name__ = "SimpleCrypter" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = None __type__ = "crypter" __description__ = """Base crypter plugin""" @@ -39,7 +39,7 @@ class SimpleCrypter(Crypter): """ def decrypt(self, pyfile): - self.html = self.load(pyfile.url) + self.html = self.load(pyfile.url, decode=True) package_name, folder_name = self.getPackageNameAndFolder() -- cgit v1.2.3 From 75f150e522cb11fe3de2df05bc3ef5356872db19 Mon Sep 17 00:00:00 2001 From: Stefano Date: Tue, 2 Apr 2013 21:46:15 +0200 Subject: SimpleHoster: fixed wrong pattern names in documentation --- 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 cfc9f2b43..69ed57ff8 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -155,8 +155,8 @@ class SimpleHoster(Hoster): """ These patterns should be defined by each hoster: FILE_INFO_PATTERN = r'(?Pfile_name) (?Pfile_size) (?Punits)' - or FILE_NAME_INFO = r'(?Pfile_name)' - and FILE_SIZE_INFO = r'(?Pfile_size) (?Punits)' + or FILE_NAME_PATTERN = r'(?Pfile_name)' + and FILE_SIZE_PATTERN = r'(?Pfile_size) (?Punits)' FILE_OFFLINE_PATTERN = r'File (deleted|not found)' TEMP_OFFLINE_PATTERN = r'Server maintainance' """ -- cgit v1.2.3 From 12741a9f656cd5a0a96c29ed63a2988c5c2be9da Mon Sep 17 00:00:00 2001 From: nilo Date: Wed, 3 Apr 2013 14:04:03 +0200 Subject: added progress to unrar --- module/plugins/internal/UnRar.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index ef04f558e..ef31fbae2 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -114,15 +114,31 @@ class UnRar(AbtractExtractor): def extract(self, progress, password=None): command = "x" if self.fullpath else "e" - # popen thinks process is still alive (just like pexpect) - very strange behavior - # so for now progress can not be determined correctly p = self.call_unrar(command, self.file, self.out, password=password) renice(p.pid, self.renice) progress(0) - out, err = p.communicate() #wait for process + progressstring = "" + while True: + c = p.stdout.read(1) + # quit loop on eof + if not c: + break + # reading a percentage sign -> set progress and restart + if c == '%': + progress(int(progressstring)) + progressstring = "" + # not reading a digit -> therefore restart + elif re.match('[0-9]',c) is None: + progressstring = "" + # add digit to progressstring + else: + progressstring = progressstring + c progress(100) + # retrieve stderr + err = p.stderr.read() + if "CRC failed" in err and not password and not self.passwordProtected: raise CRCError elif "CRC failed" in err: -- cgit v1.2.3 From d8fd1819a672887471678344a856747302d9cd56 Mon Sep 17 00:00:00 2001 From: Stefano Date: Wed, 3 Apr 2013 18:06:47 +0300 Subject: SimpleCrypter: trivial fix in documentation --- module/plugins/internal/SimpleCrypter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'module/plugins/internal') diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index a36df1979..b2cc03985 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -18,8 +18,10 @@ """ import re + from module.plugins.Crypter import Crypter + class SimpleCrypter(Crypter): __name__ = "SimpleCrypter" __version__ = "0.04" @@ -29,7 +31,7 @@ class SimpleCrypter(Crypter): __author_name__ = ("stickell", "zoidberg") __author_mail__ = ("l.stickell@yahoo.it", "zoidberg@mujmail.cz") """ - These patterns should be defined by each hoster: + These patterns should be defined by each crypter: LINK_PATTERN: group(1) must be a download link example: