summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-10-25 21:59:29 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-10-25 21:59:29 +0200
commit73ec4c51be8e8b5f45abe3e5eebe066957ad4f4c (patch)
treeb70e32e13aa8d0aa710be59a35bf503fc5bc59b4 /module/plugins
parentclosed #410 (diff)
downloadpyload-73ec4c51be8e8b5f45abe3e5eebe066957ad4f4c.tar.xz
also use "rar" to extract
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/hooks/ExtractArchive.py2
-rw-r--r--module/plugins/internal/UnRar.py25
2 files changed, 15 insertions, 12 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)