diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-10-08 20:46:13 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-10-08 20:46:13 +0200 |
commit | 5005d912e1585cd34b08f1f6faefb17e3c9d4c4d (patch) | |
tree | 3ddf1a1f1e480a9341260a442e818c49ea318bd3 | |
parent | reconnect debug (diff) | |
download | pyload-5005d912e1585cd34b08f1f6faefb17e3c9d4c4d.tar.xz |
unrar renice
-rw-r--r-- | module/pyunrar.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/module/pyunrar.py b/module/pyunrar.py index 8b9892f8e..14379ffcb 100644 --- a/module/pyunrar.py +++ b/module/pyunrar.py @@ -90,10 +90,7 @@ class Unrar(): if os.name == "nt": self.cmd = [join(pypath, "UnRAR.exe")] else: - if cpu: - self.cmd = ["nice", "-%s" % cpu,"unrar"] - else: - self.cmd = ["unrar"] + self.cmd = ["unrar"] self.encrypted = None self.headerEncrypted = None self.smallestFiles = None @@ -104,7 +101,16 @@ class Unrar(): self.tmpdir = tmpdir +"_" + basename(archive).replace(".rar", "").replace(".","") self.ram = ramSize + self.cpu = cpu + + def renice(self, p): + """ renice process """ + if os.name != "nt" and self.cpu: + try: + Popen(["renice", self.cpu, p.pid], stdout=PIPE, bufsize=-1) + except: + print "Renice failed" def listContent(self, password=None): """ @@ -222,6 +228,7 @@ class Unrar(): except WrongPasswordError: return False p = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, bufsize=-1) + self.renice(p) (ret, out) = self.processOutput(p, statusFunction) if ret == 3: raise False @@ -259,6 +266,7 @@ class Unrar(): if destination: args.append(destination) p = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, bufsize=-1) + self.renice(p) (ret, out) = self.processOutput(p, statusFunction) if ret == 3: raise WrongPasswordError() |