diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/internal/Extractor.py | 4 | ||||
-rw-r--r-- | module/plugins/internal/SevenZip.py | 17 | ||||
-rw-r--r-- | module/plugins/internal/UnZip.py | 6 |
3 files changed, 17 insertions, 10 deletions
diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 3ea634ec8..4c38760f2 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -19,7 +19,7 @@ class PasswordError(Exception): class Extractor: __name__ = "Extractor" - __version__ = "0.16" + __version__ = "0.17" __description__ = """Base extractor plugin""" __license__ = "GPLv3" @@ -37,7 +37,7 @@ class Extractor: @classmethod - def checkDeps(cls): + def isUsable(cls): """ Check if system statisfy dependencies :return: boolean """ diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index 6ba7cfc1f..05be90702 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -11,7 +11,7 @@ from module.utils import fs_encode, save_join class SevenZip(UnRar): __name__ = "SevenZip" - __version__ = "0.04" + __version__ = "0.05" __description__ = """7-Zip extractor plugin""" __license__ = "GPLv3" @@ -36,7 +36,7 @@ class SevenZip(UnRar): @classmethod - def checkDeps(cls): + def isUsable(cls): if os.name == "nt": cls.CMD = os.path.join(pypath, "7z.exe") p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE) @@ -49,7 +49,15 @@ class SevenZip(UnRar): def check(self): - p = self.call_cmd("l", "-slt", fs_encode(self.filename)) + file = fs_encode(self.filename) + + p = self.call_cmd("t", file) + p.communicate() + + if p.returncode > 1: + raise CRCError + + p = self.call_cmd("l", "-slt", file) out, err = p.communicate() if p.returncode > 1: @@ -127,12 +135,11 @@ class SevenZip(UnRar): p = self.call_cmd(command, fs_encode(self.filename), password=password) out, err = p.communicate() - code = p.returncode if "Can not open" in err: raise ArchiveError("Cannot open file") - if code != 0: + if p.returncode > 1: raise ArchiveError("Process terminated unsuccessful") result = set() diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py index a086d9db1..83ed3a233 100644 --- a/module/plugins/internal/UnZip.py +++ b/module/plugins/internal/UnZip.py @@ -12,7 +12,7 @@ from module.utils import fs_encode class UnZip(Extractor): __name__ = "UnZip" - __version__ = "1.04" + __version__ = "1.05" __description__ = """Zip extractor plugin""" __license__ = "GPLv3" @@ -23,13 +23,13 @@ class UnZip(Extractor): @classmethod - def checkDeps(cls): + def isUsable(cls): return sys.version_info[:2] >= (2, 6) @classmethod def getTargets(cls, files_ids): - return [(filename, id) for filename, id in files_ids if cls.isArchive(filename)] + return [(fname, id) for fname, id in files_ids if cls.isArchive(fname)] def extract(self, password=None): |