diff options
author | Jens Hörnlein <jens.hoernlein@googlemail.com> | 2015-02-08 13:47:59 +0100 |
---|---|---|
committer | Jens Hörnlein <jens.hoernlein@googlemail.com> | 2015-02-09 23:36:28 +0100 |
commit | 2a809297f288a585d96af0d8afd894c2a2f695fb (patch) | |
tree | 2b9d53e140977c25023059db5be9ea91469dd556 /module/plugins/internal/UnRar.py | |
parent | [ExtractArchive] Fix: Show Status/Progressbar (diff) | |
download | pyload-2a809297f288a585d96af0d8afd894c2a2f695fb.tar.xz |
[ExtractArchive] correct fullpath behavior, bugfix
Diffstat (limited to 'module/plugins/internal/UnRar.py')
-rw-r--r-- | module/plugins/internal/UnRar.py | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 81cfb38a7..0ba990006 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.10" + __version__ = "1.11" __description__ = """Rar extractor plugin""" __license__ = "GPLv3" @@ -37,15 +37,16 @@ class UnRar(Extractor): ".ace", ".uue", ".jar", ".iso", ".7z", ".xz", ".z"] #@NOTE: there are some more uncovered rar formats - re_rarpart1 = re.compile(r'\.part(\d+)\.rar$', re.I) - re_rarpart2 = re.compile(r'\.r(\d+)$', re.I) + re_rarpart1 = re.compile(r'\.part(\d+)\.rar$', re.I) + re_rarpart2 = re.compile(r'\.r(\d+)$', re.I) re_filefixed = re.compile(r'Building (.+)') - re_filelist = re.compile(r'(.+)\s+(\D+)\s+(\d+)\s+\d\d-\d\d-\d\d\s+\d\d:\d\d\s+(.+)') + re_filelist = re.compile(r'(.+)\s+(\d+)\s+\d\d-\d\d-\d\d\s+\d\d:\d\d\s+(.+)') re_wrongpwd = re.compile(r'password', re.I) re_wrongcrc = re.compile(r'encrypted|damaged|CRC failed|checksum error', re.I) + re_version = re.compile(r'UNRAR\s(\d+)\.\d+', re.I) @classmethod def isUsable(cls): @@ -185,6 +186,10 @@ class UnRar(Extractor): def list(self, password=None): command = "vb" if self.fullpath else "lb" + p = self.call_cmd("", "", fs_encode(self.filename)) + out, err = p.communicate() + version = self.re_version.search(out).group(1) + p = self.call_cmd(command, "-v", fs_encode(self.filename), password=password) out, err = p.communicate() @@ -195,9 +200,16 @@ class UnRar(Extractor): self.manager.logError(err.strip()) result = set() - for f in decode(out).splitlines(): - f = f.strip() - result.add(save_join(self.out, f)) + if not self.fullpath and version =='5': + # NOTE: Unrar 5 always list full path + for f in 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(): + f = f.strip() + result.add(save_join(self.out, f)) return list(result) |