summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/hooks/UnRar.py7
-rw-r--r--module/pyunrar.py4
2 files changed, 9 insertions, 2 deletions
diff --git a/module/plugins/hooks/UnRar.py b/module/plugins/hooks/UnRar.py
index 4f989e804..5d1dff1a5 100644
--- a/module/plugins/hooks/UnRar.py
+++ b/module/plugins/hooks/UnRar.py
@@ -22,6 +22,7 @@ import sys
from module.plugins.Hook import Hook
from module.pyunrar import Unrar, WrongPasswordError, CommandError, UnknownError
+from traceback import print_exc
from os.path import exists, join
from os import remove
@@ -118,6 +119,8 @@ class UnRar(Hook):
self.core.log.info("Unrar of %s failed (wrong password)" % fname)
continue
except CommandError, e:
+ if self.core.debug:
+ print_exc()
if re.search("Cannot find volume", e.stderr):
self.core.log.info("Unrar of %s failed (missing volume)" % fname)
continue
@@ -126,9 +129,13 @@ class UnRar(Hook):
self.core.log.info("Unrar of %s ok" % fname)
self.removeFiles(pack, fname)
except:
+ if self.core.debug:
+ print_exc()
self.core.log.info("Unrar of %s failed" % fname)
continue
except UnknownError:
+ if self.core.debug:
+ print_exc()
self.core.log.info("Unrar of %s failed" % fname)
continue
else:
diff --git a/module/pyunrar.py b/module/pyunrar.py
index 2ce8a846f..b39c176d6 100644
--- a/module/pyunrar.py
+++ b/module/pyunrar.py
@@ -126,7 +126,7 @@ class Unrar():
infos = {}
nameLine = False
name = ""
- for line in o.split("\n"):
+ for line in o.splitlines():
if line == "-"*79:
inList = not inList
continue
@@ -343,7 +343,7 @@ class Unrar():
perc = int(tperc)
statusFunction(perc)
elif count >= 3:
- if tmp == "\n":
+ if tmp in ("\r","\n","\r\n"):
count = 0
elif tmp in digits:
tperc += tmp