diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-10-25 21:59:29 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-10-25 21:59:29 +0200 |
commit | 73ec4c51be8e8b5f45abe3e5eebe066957ad4f4c (patch) | |
tree | b70e32e13aa8d0aa710be59a35bf503fc5bc59b4 | |
parent | closed #410 (diff) | |
download | pyload-73ec4c51be8e8b5f45abe3e5eebe066957ad4f4c.tar.xz |
also use "rar" to extract
-rw-r--r-- | module/plugins/hooks/ExtractArchive.py | 2 | ||||
-rw-r--r-- | module/plugins/internal/UnRar.py | 25 | ||||
-rw-r--r-- | pavement.py | 2 |
3 files changed, 16 insertions, 13 deletions
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 5bedc4293..2e8daad35 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -97,7 +97,7 @@ class ExtractArchive(Hook): except OSError, e: if e.errno == 2: - self.logInfo(_("No %s installed")) + self.logInfo(_("No %s installed") % p) else: self.logWarning(_("Could not activate %s") % p, str(e)) if self.core.debug: diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 3f27c2e9e..7ba1d01ba 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -36,16 +36,25 @@ class UnRar(AbtractExtractor): re_splitfile = re.compile(r"(.*)\.part(\d+)\.rar$") re_filelist = re.compile(r"(.+)\s+(\d+)\s+(\d+)\s+") re_wrongpwd = re.compile("(Corrupt file or wrong password|password incorrect)") + CMD = "unrar" @staticmethod def checkDeps(): if os.name == "nt": - cmd = join(pypath, "UnRAR.exe") + UnRar.CMD = join(pypath, "UnRAR.exe") + p = Popen([UnRar.CMD], stdout=PIPE, stderr=PIPE) + p.communicate() else: - cmd = "unrar" + try: + p = Popen([UnRar.CMD], stdout=PIPE, stderr=PIPE) + p.communicate() + except OSError: + + #fallback to rar + UnRar.CMD = "rar" + p = Popen([UnRar.CMD], stdout=PIPE, stderr=PIPE) + p.communicate() - p = Popen([cmd], stdout=PIPE, stderr=PIPE) - p.communicate() return True @staticmethod @@ -153,13 +162,7 @@ class UnRar(AbtractExtractor): def call_unrar(self, command, *xargs, **kwargs): - if os.name == "nt": - cmd = join(pypath, "UnRAR.exe") - else: - cmd = "unrar" - args = [] - #overwrite flag args.append("-o+") if self.overwrite else args.append("-o-") @@ -174,7 +177,7 @@ class UnRar(AbtractExtractor): #NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue - call = [cmd, command] + args + list(xargs) + call = [self.CMD, command] + args + list(xargs) self.m.logDebug(" ".join(call)) p = Popen(call, stdout=PIPE, stderr=PIPE) diff --git a/pavement.py b/pavement.py index c77e93178..92fbef573 100644 --- a/pavement.py +++ b/pavement.py @@ -35,7 +35,7 @@ setup( #package_data=find_package_data(), #data_files=[], include_package_data=True, - exclude_package_data={'pyload': ['docs*', 'scripts*']}, + exclude_package_data={'pyload': ['docs*', 'scripts*']}, #exluced from build but not from sdist #leaving out thrift 0.8.0 since its not statisfiable install_requires=['BeautifulSoup>=3.2, <3.3', 'jinja2', 'pycurl', 'Beaker', 'bottle >= 0.9.0'] + extradeps, extras_require={ |