summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal/SevenZip.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2015-01-31 20:13:28 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2015-01-31 20:13:28 +0100
commitb2904e3e704ece4e891f3d2bfbcc8af2d6d8c2e1 (patch)
tree29cdc1dfc53ca691e23aa68c348076b3cc78d4ab /module/plugins/internal/SevenZip.py
parent[ZeveraCom] Re-fix account expire recognition (diff)
downloadpyload-b2904e3e704ece4e891f3d2bfbcc8af2d6d8c2e1.tar.xz
[SevenZip] Better check method + fix list method
Diffstat (limited to 'module/plugins/internal/SevenZip.py')
-rw-r--r--module/plugins/internal/SevenZip.py17
1 files changed, 12 insertions, 5 deletions
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()