diff options
author | 2015-07-21 22:55:54 +0200 | |
---|---|---|
committer | 2015-07-21 22:55:54 +0200 | |
commit | c2091ebec0ce394ec847f82db9bbaddc150d5fca (patch) | |
tree | 04e2515544d3d47242c991fe540954c0d0080164 /module/plugins/internal/SevenZip.py | |
parent | New Captcha skeleton (diff) | |
download | pyload-c2091ebec0ce394ec847f82db9bbaddc150d5fca.tar.xz |
[Extractor] is_usable -> find
Diffstat (limited to 'module/plugins/internal/SevenZip.py')
-rw-r--r-- | module/plugins/internal/SevenZip.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index dc0d765cf..f2194157c 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -10,7 +10,7 @@ from module.utils import fs_encode, save_join as fs_join class SevenZip(UnRar): __name__ = "SevenZip" - __version__ = "0.12" + __version__ = "0.13" __status__ = "stable" __description__ = """7-Zip extractor plugin""" @@ -38,19 +38,23 @@ class SevenZip(UnRar): @classmethod - def is_usable(cls): - if os.name == "nt": - cls.CMD = os.path.join(pypath, "7z.exe") - p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - out, err = p.communicate() - else: + def find(cls): + try: + if os.name == "nt": + cls.CMD = os.path.join(pypath, "7z.exe") + p = subprocess.Popen([cls.CMD], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() - m = cls.re_version.search(out) - cls.VERSION = m.group(1) if m else '(version unknown)' + except OSError: + return False + + else: + return True - return True + finally: + m = cls.re_version.search(out) + cls.VERSION = m.group(1) if m else '(version unknown)' def verify(self, password): |