diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-03-04 02:21:50 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-03-04 02:21:50 +0100 |
commit | 8b432eb80715f84800febb88620d943211e28051 (patch) | |
tree | eabc9cd771e9240ce895aee417d60412924c0693 | |
parent | [ClickAndLoad] Revert and improve (diff) | |
download | pyload-8b432eb80715f84800febb88620d943211e28051.tar.xz |
-rw-r--r-- | module/plugins/internal/Extractor.py | 22 | ||||
-rw-r--r-- | module/plugins/internal/SevenZip.py | 10 | ||||
-rw-r--r-- | module/plugins/internal/UnRar.py | 12 | ||||
-rw-r--r-- | module/plugins/internal/UnZip.py | 7 |
4 files changed, 25 insertions, 26 deletions
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() |