From 1ecdd9f6b53fec45e1d48592e3ff56aa7a576bec Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 8 Jan 2012 16:47:52 +0100 Subject: some cleanups, closed #490 --- module/plugins/internal/UnRar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index feac4c176..9f57a9ad6 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -23,7 +23,7 @@ from os.path import join from glob import glob from subprocess import Popen, PIPE -from module.utils import save_join, decode +from module.utils.fs import save_join, decode from module.plugins.internal.AbstractExtractor import AbtractExtractor, WrongPassword, ArchiveError, CRCError class UnRar(AbtractExtractor): -- cgit v1.2.3 From a2ab9ced6ffb038a051e465f06d8b5ca6512a79b Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 22 Jan 2012 13:59:46 +0100 Subject: try to fix unrar encoding issues --- 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 9f57a9ad6..ce271bec4 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -23,7 +23,7 @@ from os.path import join from glob import glob from subprocess import Popen, PIPE -from module.utils.fs import save_join, decode +from module.utils.fs import save_join, decode, fs_encode from module.plugins.internal.AbstractExtractor import AbtractExtractor, WrongPassword, ArchiveError, CRCError class UnRar(AbtractExtractor): @@ -39,7 +39,7 @@ class UnRar(AbtractExtractor): @staticmethod def checkDeps(): if os.name == "nt": - UnRar.CMD = join(pypath, "UnRAR.exe") + UnRar.CMD = save_join(pypath, "UnRAR.exe") p = Popen([UnRar.CMD], stdout=PIPE, stderr=PIPE) p.communicate() else: @@ -80,7 +80,7 @@ class UnRar(AbtractExtractor): self.password = "" #save the correct password def checkArchive(self): - p = self.call_unrar("l", "-v", self.file) + p = self.call_unrar("l", "-v", fs_encode(self.file)) out, err = p.communicate() if self.re_wrongpwd.search(err): self.passwordProtected = True @@ -102,7 +102,7 @@ class UnRar(AbtractExtractor): def checkPassword(self, password): #at this point we can only verify header protected files if self.headerProtected: - p = self.call_unrar("l", "-v", self.file, password=password) + p = self.call_unrar("l", "-v", fs_encode(self.file), password=password) out, err = p.communicate() if self.re_wrongpwd.search(err): return False @@ -115,7 +115,7 @@ class UnRar(AbtractExtractor): # 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) + p = self.call_unrar(command, fs_encode(self.file), self.out, password=password) renice(p.pid, self.renice) progress(0) @@ -141,7 +141,7 @@ class UnRar(AbtractExtractor): def listContent(self): command = "vb" if self.fullpath else "lb" - p = self.call_unrar(command, "-v", self.file, password=self.password) + p = self.call_unrar(command, "-v", fs_encode(self.file), password=self.password) out, err = p.communicate() if "Cannot open" in err: -- cgit v1.2.3 From 5aa52ea8d5c3d28f350dc47d23d14f230be499eb Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 22 Jan 2012 16:31:12 +0000 Subject: Fix encoding issues in RAR plugin log messages --- module/plugins/internal/UnRar.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'module/plugins/internal/UnRar.py') diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index ce271bec4..ebb5cdbd6 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -23,7 +23,7 @@ from os.path import join from glob import glob from subprocess import Popen, PIPE -from module.utils.fs import save_join, decode, fs_encode +from module.utils.fs import save_join, decode, fs_encode, fs_decode from module.plugins.internal.AbstractExtractor import AbtractExtractor, WrongPassword, ArchiveError, CRCError class UnRar(AbtractExtractor): @@ -66,9 +66,9 @@ class UnRar(AbtractExtractor): if match: #only add first parts if int(match[0][1]) == 1: - result.append((file, id)) + result.append((fs_decode(file), id)) else: - result.append((file, id)) + result.append((fs_decode(file), id)) return result @@ -136,8 +136,8 @@ class UnRar(AbtractExtractor): def getDeleteFiles(self): if ".part" in self.file: - return glob(re.sub("(?<=\.part)([01]+)", "*", self.file, re.IGNORECASE)) - return [self.file] + return glob(re.sub("(?<=\.part)([01]+)", "*", fd_decode(self.file), re.IGNORECASE)) + return [fs_decode(self.file)] def listContent(self): command = "vb" if self.fullpath else "lb" @@ -176,7 +176,7 @@ class UnRar(AbtractExtractor): #NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue call = [self.CMD, command] + args + list(xargs) - self.m.logDebug(" ".join(call)) + self.m.logDebug(" ".join([decode(arg) for arg in call])) p = Popen(call, stdout=PIPE, stderr=PIPE) @@ -188,4 +188,4 @@ def renice(pid, value): try: Popen(["renice", str(value), str(pid)], stdout=PIPE, stderr=PIPE, bufsize=-1) except: - print "Renice failed" \ No newline at end of file + print "Renice failed" -- cgit v1.2.3 From ddb01583858279a51c1579c6d0cafc5d5f32f8d5 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 22 Jan 2012 17:56:15 +0100 Subject: removed some fs_decode functions --- module/plugins/internal/UnRar.py | 11 +++++------ 1 file changed, 5 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 ebb5cdbd6..a315fbea3 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -19,11 +19,10 @@ import os import re -from os.path import join from glob import glob from subprocess import Popen, PIPE -from module.utils.fs import save_join, decode, fs_encode, fs_decode +from module.utils.fs import save_join, decode, fs_encode from module.plugins.internal.AbstractExtractor import AbtractExtractor, WrongPassword, ArchiveError, CRCError class UnRar(AbtractExtractor): @@ -66,9 +65,9 @@ class UnRar(AbtractExtractor): if match: #only add first parts if int(match[0][1]) == 1: - result.append((fs_decode(file), id)) + result.append((file, id)) else: - result.append((fs_decode(file), id)) + result.append((file, id)) return result @@ -136,8 +135,8 @@ class UnRar(AbtractExtractor): def getDeleteFiles(self): if ".part" in self.file: - return glob(re.sub("(?<=\.part)([01]+)", "*", fd_decode(self.file), re.IGNORECASE)) - return [fs_decode(self.file)] + return glob(re.sub("(?<=\.part)([01]+)", "*", self.file, re.IGNORECASE)) + return [self.file] def listContent(self): command = "vb" if self.fullpath else "lb" -- cgit v1.2.3