diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/hooks/ExtractArchive.py | 3 | ||||
-rw-r--r-- | module/plugins/internal/UnRar.py | 12 |
2 files changed, 7 insertions, 8 deletions
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index d9c2e57bb..53f88b3a5 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -3,7 +3,6 @@ import sys import os -from os import remove, chmod, makedirs from os.path import basename, isfile, isdir, join from traceback import print_exc from copy import copy @@ -48,7 +47,7 @@ if os.name != "nt": from pwd import getpwnam from grp import getgrnam -from module.utils.fs import save_join, fs_encode, exists +from module.utils.fs import save_join, fs_encode, exists, remove, chmod, makedirs from module.plugins.Hook import Hook, threaded, Expose from module.plugins.internal.AbstractExtractor import ArchiveError, CRCError, WrongPassword diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index b3c2fe6af..ebb5cdbd6 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -19,10 +19,11 @@ 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_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): @@ -38,7 +39,7 @@ class UnRar(AbtractExtractor): @staticmethod def checkDeps(): if os.name == "nt": - UnRar.CMD = safe_join(pypath, "UnRAR.exe") + UnRar.CMD = save_join(pypath, "UnRAR.exe") p = Popen([UnRar.CMD], stdout=PIPE, stderr=PIPE) p.communicate() else: @@ -134,8 +135,8 @@ class UnRar(AbtractExtractor): def getDeleteFiles(self): - if ".part" in fs_encode(self.file): - return glob(re.sub("(?<=\.part)([01]+)", "*", fs_decode(self.file), re.IGNORECASE)) + if ".part" in self.file: + return glob(re.sub("(?<=\.part)([01]+)", "*", fd_decode(self.file), re.IGNORECASE)) return [fs_decode(self.file)] def listContent(self): @@ -175,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([decode(a) for a in call])) + self.m.logDebug(" ".join([decode(arg) for arg in call])) p = Popen(call, stdout=PIPE, stderr=PIPE) @@ -188,4 +189,3 @@ def renice(pid, value): Popen(["renice", str(value), str(pid)], stdout=PIPE, stderr=PIPE, bufsize=-1) except: print "Renice failed" - |