From 5a139055ae658d3a05cbb658cbd66aeae0d01db5 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 21:06:10 +0200 Subject: Spare code cosmetics --- module/plugins/internal/UnRar.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 5b9f2e1c3..85e939b6a 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -8,7 +8,7 @@ from glob import glob from string import digits from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, PasswordError -from module.utils import fs_decode, fs_encode, save_join +from module.utils import fs_decode, fs_encode, save_join as fs_join def renice(pid, value): @@ -175,7 +175,7 @@ class UnRar(Extractor): files = [self.filename] # eventually Multipart Files - files.extend(save_join(dir, os.path.basename(file)) for file in filter(self.isMultipart, os.listdir(dir)) + files.extend(fs_join(dir, os.path.basename(file)) for file in filter(self.isMultipart, os.listdir(dir)) if re.sub(self.re_multipart,".rar",name) == re.sub(self.re_multipart,".rar",file)) return files @@ -197,13 +197,13 @@ class UnRar(Extractor): if not self.fullpath and self.VERSION.startswith('5'): # NOTE: Unrar 5 always list full path for f in fs_decode(out).splitlines(): - f = save_join(self.out, os.path.basename(f.strip())) + f = fs_join(self.out, os.path.basename(f.strip())) if os.path.isfile(f): - result.add(save_join(self.out, os.path.basename(f))) + result.add(fs_join(self.out, os.path.basename(f))) else: for f in fs_decode(out).splitlines(): f = f.strip() - result.add(save_join(self.out, f)) + result.add(fs_join(self.out, f)) return list(result) -- cgit v1.2.3 From 20b6a2ec022202b0efb6cb69415239fb8f4d1445 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Jun 2015 18:59:20 +0200 Subject: Spare code cosmetics (2) --- module/plugins/internal/UnRar.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 85e939b6a..25a8a52de 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -105,7 +105,7 @@ class UnRar(Extractor): if self.re_wrongcrc.search(err): raise CRCError(err) - # output only used to check if passworded files are present + #: output only used to check if passworded files are present for attr in self.re_filelist.findall(out): if attr[0].startswith("*"): raise PasswordError @@ -114,7 +114,7 @@ class UnRar(Extractor): def repair(self): p = self.call_cmd("rc", fs_encode(self.filename)) - # communicate and retrieve stderr + #: communicate and retrieve stderr self._progress(p) err = p.stderr.read().strip() if err or p.returncode: @@ -126,17 +126,17 @@ class UnRar(Extractor): s = "" while True: c = process.stdout.read(1) - # quit loop on eof + #: quit loop on eof if not c: break - # reading a percentage sign -> set progress and restart + #: reading a percentage sign -> set progress and restart if c == '%': self.notifyProgress(int(s)) s = "" - # not reading a digit -> therefore restart + #: not reading a digit -> therefore restart elif c not in digits: s = "" - # add digit to progressstring + #: add digit to progressstring else: s += c @@ -148,7 +148,7 @@ class UnRar(Extractor): renice(p.pid, self.renice) - # communicate and retrieve stderr + #: communicate and retrieve stderr self._progress(p) err = p.stderr.read().strip() @@ -171,10 +171,10 @@ class UnRar(Extractor): def getDeleteFiles(self): dir, name = os.path.split(self.filename) - # actually extracted file + #: actually extracted file files = [self.filename] - # eventually Multipart Files + #: eventually Multipart Files files.extend(fs_join(dir, os.path.basename(file)) for file in filter(self.isMultipart, os.listdir(dir)) if re.sub(self.re_multipart,".rar",name) == re.sub(self.re_multipart,".rar",file)) @@ -195,7 +195,7 @@ class UnRar(Extractor): result = set() if not self.fullpath and self.VERSION.startswith('5'): - # NOTE: Unrar 5 always list full path + #@NOTE: Unrar 5 always list full path for f in fs_decode(out).splitlines(): f = fs_join(self.out, os.path.basename(f.strip())) if os.path.isfile(f): @@ -211,7 +211,7 @@ class UnRar(Extractor): def call_cmd(self, command, *xargs, **kwargs): args = [] - # overwrite flag + #: overwrite flag if self.overwrite: args.append("-o+") else: @@ -222,10 +222,10 @@ class UnRar(Extractor): for word in self.excludefiles: args.append("-x'%s'" % word.strip()) - # assume yes on all queries + #: assume yes on all queries args.append("-y") - # set a password + #: set a password if "password" in kwargs and kwargs['password']: args.append("-p%s" % kwargs['password']) else: @@ -234,7 +234,7 @@ class UnRar(Extractor): if self.keepbroken: args.append("-kb") - # NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue + #@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue call = [self.CMD, command] + args + list(xargs) self.manager.logDebug(" ".join(call)) -- cgit v1.2.3 From b1759bc440cd6013837697eb8de540914f693ffd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Jul 2015 01:23:55 +0200 Subject: No camelCase style anymore --- module/plugins/internal/UnRar.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 25a8a52de..4494b98c6 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.20" + __version__ = "1.21" __description__ = """Rar extractor plugin""" __license__ = "GPLv3" @@ -48,7 +48,7 @@ class UnRar(Extractor): @classmethod - def isUsable(cls): + def is_usable(cls): if os.name == "nt": try: cls.CMD = os.path.join(pypath, "RAR.exe") @@ -79,7 +79,7 @@ class UnRar(Extractor): @classmethod - def isMultipart(cls, filename): + def is_multipart(cls, filename): return True if cls.re_multipart.search(filename) else False @@ -131,7 +131,7 @@ class UnRar(Extractor): break #: reading a percentage sign -> set progress and restart if c == '%': - self.notifyProgress(int(s)) + self.notify_progress(int(s)) s = "" #: not reading a digit -> therefore restart elif c not in digits: @@ -168,14 +168,14 @@ class UnRar(Extractor): self.files = self.list(password) - def getDeleteFiles(self): + def get_delete_files(self): dir, name = os.path.split(self.filename) #: actually extracted file files = [self.filename] #: eventually Multipart Files - files.extend(fs_join(dir, os.path.basename(file)) for file in filter(self.isMultipart, os.listdir(dir)) + files.extend(fs_join(dir, os.path.basename(file)) for file in filter(self.is_multipart, os.listdir(dir)) if re.sub(self.re_multipart,".rar",name) == re.sub(self.re_multipart,".rar",file)) return files -- cgit v1.2.3 From d2e2b127651a5a44b56337eb6d9ca246c97a208a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 17 Jul 2015 03:03:26 +0200 Subject: Spare fixes and code cosmetics --- module/plugins/internal/UnRar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 4494b98c6..50c421e8d 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -191,7 +191,7 @@ class UnRar(Extractor): raise ArchiveError(_("Cannot open file")) if err.strip(): #: only log error at this point - self.manager.logError(err.strip()) + self.manager.log_error(err.strip()) result = set() if not self.fullpath and self.VERSION.startswith('5'): @@ -237,7 +237,7 @@ class UnRar(Extractor): #@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue call = [self.CMD, command] + args + list(xargs) - self.manager.logDebug(" ".join(call)) + self.manager.log_debug(" ".join(call)) p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return p -- cgit v1.2.3 From dad722ac7255640e7e0541c4094a4d2e4de79cd3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 00:05:58 +0200 Subject: Code cosmetics (2) --- module/plugins/internal/UnRar.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 50c421e8d..abd94b4df 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -68,7 +68,7 @@ class UnRar(Extractor): cls.__name__ = "RAR" cls.REPAIR = True - except OSError: #: fallback to unrar + except OSError: #: Fallback to unrar p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() @@ -105,7 +105,7 @@ class UnRar(Extractor): if self.re_wrongcrc.search(err): raise CRCError(err) - #: output only used to check if passworded files are present + #: Output only used to check if passworded files are present for attr in self.re_filelist.findall(out): if attr[0].startswith("*"): raise PasswordError @@ -114,7 +114,7 @@ class UnRar(Extractor): def repair(self): p = self.call_cmd("rc", fs_encode(self.filename)) - #: communicate and retrieve stderr + #: Communicate and retrieve stderr self._progress(p) err = p.stderr.read().strip() if err or p.returncode: @@ -126,17 +126,17 @@ class UnRar(Extractor): s = "" while True: c = process.stdout.read(1) - #: quit loop on eof + #: Quit loop on eof if not c: break - #: reading a percentage sign -> set progress and restart + #: Reading a percentage sign -> set progress and restart if c == '%': self.notify_progress(int(s)) s = "" - #: not reading a digit -> therefore restart + #: Not reading a digit -> therefore restart elif c not in digits: s = "" - #: add digit to progressstring + #: Add digit to progressstring else: s += c @@ -148,7 +148,7 @@ class UnRar(Extractor): renice(p.pid, self.renice) - #: communicate and retrieve stderr + #: Communicate and retrieve stderr self._progress(p) err = p.stderr.read().strip() @@ -159,7 +159,7 @@ class UnRar(Extractor): elif self.re_wrongcrc.search(err): raise CRCError(err) - else: #: raise error if anything is on stderr + else: #: Raise error if anything is on stderr raise ArchiveError(err) if p.returncode: @@ -171,7 +171,7 @@ class UnRar(Extractor): def get_delete_files(self): dir, name = os.path.split(self.filename) - #: actually extracted file + #: Actually extracted file files = [self.filename] #: eventually Multipart Files @@ -190,7 +190,7 @@ class UnRar(Extractor): if "Cannot open" in err: raise ArchiveError(_("Cannot open file")) - if err.strip(): #: only log error at this point + if err.strip(): #: Only log error at this point self.manager.log_error(err.strip()) result = set() @@ -211,7 +211,7 @@ class UnRar(Extractor): def call_cmd(self, command, *xargs, **kwargs): args = [] - #: overwrite flag + #: Overwrite flag if self.overwrite: args.append("-o+") else: @@ -222,10 +222,10 @@ class UnRar(Extractor): for word in self.excludefiles: args.append("-x'%s'" % word.strip()) - #: assume yes on all queries + #: Assume yes on all queries args.append("-y") - #: set a password + #: Set a password if "password" in kwargs and kwargs['password']: args.append("-p%s" % kwargs['password']) else: -- cgit v1.2.3 From 56389e28ba5d2f5658278bc7f486d73be747f135 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 11:44:49 +0200 Subject: Rename self.core to self.pyload (plugins only) --- module/plugins/internal/UnRar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index abd94b4df..8f6038d64 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -191,7 +191,7 @@ class UnRar(Extractor): raise ArchiveError(_("Cannot open file")) if err.strip(): #: Only log error at this point - self.manager.log_error(err.strip()) + self.log_error(err.strip()) result = set() if not self.fullpath and self.VERSION.startswith('5'): @@ -237,7 +237,7 @@ class UnRar(Extractor): #@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue call = [self.CMD, command] + args + list(xargs) - self.manager.log_debug(" ".join(call)) + self.log_debug(" ".join(call)) p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return p -- cgit v1.2.3 From d38e830b7c0b3c6561a0072c74bbccb5fcdf4a61 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 14:43:42 +0200 Subject: New __status__ magic key --- module/plugins/internal/UnRar.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 8f6038d64..a880ab320 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -23,6 +23,7 @@ def renice(pid, value): class UnRar(Extractor): __name__ = "UnRar" __version__ = "1.21" + __status__ = "stable" __description__ = """Rar extractor plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From c2091ebec0ce394ec847f82db9bbaddc150d5fca Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 21 Jul 2015 22:55:54 +0200 Subject: [Extractor] is_usable -> find --- module/plugins/internal/UnRar.py | 45 +++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index a880ab320..03b19bcf9 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.21" + __version__ = "1.22" __status__ = "stable" __description__ = """Rar extractor plugin""" @@ -49,34 +49,37 @@ class UnRar(Extractor): @classmethod - def is_usable(cls): - if os.name == "nt": - try: + def find(cls): + try: + if os.name == "nt": cls.CMD = os.path.join(pypath, "RAR.exe") - p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = p.communicate() - cls.__name__ = "RAR" - cls.REPAIR = True + else: + cls.CMD = "rar" - except OSError: - cls.CMD = os.path.join(pypath, "UnRAR.exe") - p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = p.communicate() - else: + p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + cls.__name__ = "RAR" + cls.REPAIR = True + + except OSError: try: - p = subprocess.Popen(["rar"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = p.communicate() - cls.__name__ = "RAR" - cls.REPAIR = True + if os.name == "nt": + cls.CMD = os.path.join(pypath, "UnRAR.exe") + else: + cls.CMD = "unrar" - except OSError: #: Fallback to unrar p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() - m = cls.re_version.search(out) - cls.VERSION = m.group(1) if m else '(version unknown)' + except OSError: + return False - return True + else: + return True + + finally: + m = cls.re_version.search(out) + cls.VERSION = m.group(1) if m else '(version unknown)' @classmethod -- cgit v1.2.3 From 4fc28dc09f9632eb4a15a1ef48778427f9dcae33 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 23 Jul 2015 18:53:06 +0200 Subject: Code cosmetics --- module/plugins/internal/UnRar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 03b19bcf9..1a2e64b94 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -37,7 +37,7 @@ class UnRar(Extractor): EXTENSIONS = [".rar"] - re_multipart = re.compile(r'\.(part|r)(\d+)(?:\.rar)?(\.rev|\.bad)?',re.I) + re_multipart = re.compile(r'\.(part|r)(\d+)(?:\.rar)?(\.rev|\.bad)?', re.I) re_filefixed = re.compile(r'Building (.+)') re_filelist = re.compile(r'^(.)(\s*[\w\.\-]+)\s+(\d+\s+)+(?:\d+\%\s+)?[\d\-]{8}\s+[\d\:]{5}', re.M|re.I) @@ -180,7 +180,7 @@ class UnRar(Extractor): #: eventually Multipart Files files.extend(fs_join(dir, os.path.basename(file)) for file in filter(self.is_multipart, os.listdir(dir)) - if re.sub(self.re_multipart,".rar",name) == re.sub(self.re_multipart,".rar",file)) + if re.sub(self.re_multipart, ".rar", name) == re.sub(self.re_multipart, ".rar", file)) return files -- cgit v1.2.3 From 94d017cd2a5c1f194960827a8c7e46afc3682008 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 06:55:49 +0200 Subject: Hotfixes (2) --- module/plugins/internal/UnRar.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 1a2e64b94..90b6431ab 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -23,7 +23,7 @@ def renice(pid, value): class UnRar(Extractor): __name__ = "UnRar" __version__ = "1.22" - __status__ = "stable" + __status__ = "testing" __description__ = """Rar extractor plugin""" __license__ = "GPLv3" @@ -51,7 +51,7 @@ class UnRar(Extractor): @classmethod def find(cls): try: - if os.name == "nt": + if os.name is "nt": cls.CMD = os.path.join(pypath, "RAR.exe") else: cls.CMD = "rar" @@ -63,7 +63,7 @@ class UnRar(Extractor): except OSError: try: - if os.name == "nt": + if os.name is "nt": cls.CMD = os.path.join(pypath, "UnRAR.exe") else: cls.CMD = "unrar" @@ -134,7 +134,7 @@ class UnRar(Extractor): if not c: break #: Reading a percentage sign -> set progress and restart - if c == '%': + if c is '%': self.notify_progress(int(s)) s = "" #: Not reading a digit -> therefore restart @@ -180,7 +180,7 @@ class UnRar(Extractor): #: eventually Multipart Files files.extend(fs_join(dir, os.path.basename(file)) for file in filter(self.is_multipart, os.listdir(dir)) - if re.sub(self.re_multipart, ".rar", name) == re.sub(self.re_multipart, ".rar", file)) + if re.sub(self.re_multipart, ".rar", name) is re.sub(self.re_multipart, ".rar", file)) return files -- cgit v1.2.3 From 761ca5c66e07559925ebbdbc6531f9ca658b12ce Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 16:11:58 +0200 Subject: Code cosmetics --- module/plugins/internal/UnRar.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 90b6431ab..a2c2070b8 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -51,7 +51,7 @@ class UnRar(Extractor): @classmethod def find(cls): try: - if os.name is "nt": + if os.name == "nt": cls.CMD = os.path.join(pypath, "RAR.exe") else: cls.CMD = "rar" @@ -63,7 +63,7 @@ class UnRar(Extractor): except OSError: try: - if os.name is "nt": + if os.name == "nt": cls.CMD = os.path.join(pypath, "UnRAR.exe") else: cls.CMD = "unrar" @@ -134,7 +134,7 @@ class UnRar(Extractor): if not c: break #: Reading a percentage sign -> set progress and restart - if c is '%': + if c == "%": self.notify_progress(int(s)) s = "" #: Not reading a digit -> therefore restart -- cgit v1.2.3 From 95ed76d34290e08876dccce6840c3e09138a2047 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 27 Jul 2015 23:47:47 +0200 Subject: Spare code fixes --- module/plugins/internal/UnRar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index a2c2070b8..30b763922 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.22" + __version__ = "1.23" __status__ = "testing" __description__ = """Rar extractor plugin""" @@ -65,7 +65,7 @@ class UnRar(Extractor): try: if os.name == "nt": cls.CMD = os.path.join(pypath, "UnRAR.exe") - else: + else: cls.CMD = "unrar" p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) -- cgit v1.2.3 From 5a2781c923ecd13f3e671366fa6fa311d92d8547 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 29 Jul 2015 08:21:04 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1586 --- module/plugins/internal/UnRar.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 30b763922..92128c77f 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.23" + __version__ = "1.24" __status__ = "testing" __description__ = """Rar extractor plugin""" @@ -32,11 +32,9 @@ class UnRar(Extractor): ("Immenz" , "immenz@gmx.net" )] - CMD = "unrar" - VERSION = "" + CMD = "unrar" EXTENSIONS = [".rar"] - re_multipart = re.compile(r'\.(part|r)(\d+)(?:\.rar)?(\.rev|\.bad)?', re.I) re_filefixed = re.compile(r'Building (.+)') @@ -58,7 +56,7 @@ class UnRar(Extractor): p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() - cls.__name__ = "RAR" + # cls.__name__ = "RAR" cls.REPAIR = True except OSError: @@ -74,12 +72,11 @@ class UnRar(Extractor): except OSError: return False - else: - return True + m = cls.re_version.search(out) + if m is not None: + cls.VERSION = m.group(1) - finally: - m = cls.re_version.search(out) - cls.VERSION = m.group(1) if m else '(version unknown)' + return True @classmethod @@ -206,8 +203,7 @@ class UnRar(Extractor): result.add(fs_join(self.out, os.path.basename(f))) else: for f in fs_decode(out).splitlines(): - f = f.strip() - result.add(fs_join(self.out, f)) + result.add(fs_join(self.out, f.strip())) return list(result) -- cgit v1.2.3 From f46daaab4c262b4a727525c70d7b470af05d343c Mon Sep 17 00:00:00 2001 From: TodsDeath Date: Tue, 4 Aug 2015 00:12:05 +0200 Subject: Fix #1603 --- module/plugins/internal/UnRar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 92128c77f..0386991d9 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.24" + __version__ = "1.25" __status__ = "testing" __description__ = """Rar extractor plugin""" @@ -177,7 +177,7 @@ class UnRar(Extractor): #: eventually Multipart Files files.extend(fs_join(dir, os.path.basename(file)) for file in filter(self.is_multipart, os.listdir(dir)) - if re.sub(self.re_multipart, ".rar", name) is re.sub(self.re_multipart, ".rar", file)) + if re.sub(self.re_multipart, ".rar", name) == re.sub(self.re_multipart, ".rar", file)) return files -- cgit v1.2.3