summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2015-01-25 19:09:21 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2015-01-25 19:09:21 +0100
commit99ed44b0d919a33e3a559472893163b347cd1c37 (patch)
treee8f9635ce9c3ab9c0eaa5869a8df5432d447151e /module
parent[ClickAndLoad] Fix bad except (diff)
downloadpyload-99ed44b0d919a33e3a559472893163b347cd1c37.tar.xz
Fix reverted Extractor
Diffstat (limited to 'module')
-rw-r--r--module/plugins/hooks/ExtractArchive.py4
-rw-r--r--module/plugins/internal/UnRar.py32
2 files changed, 20 insertions, 16 deletions
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index 9e530ce8f..20e585046 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -58,7 +58,7 @@ from module.utils import save_join, fs_encode
class ExtractArchive(Hook):
__name__ = "ExtractArchive"
__type__ = "hook"
- __version__ = "1.07"
+ __version__ = "1.08"
__config__ = [("activated", "bool", "Activated", True),
("fullpath", "bool", "Extract full path", True),
@@ -254,7 +254,7 @@ class ExtractArchive(Hook):
success = False
if not plugin.checkArchive():
- plugin.extract(progress, pw)
+ plugin.extract(progress, self.getPasswords())
success = True
else:
self.logInfo(basename(plugin.file), _("Password protected"))
diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py
index a1b438e47..43592c3de 100644
--- a/module/plugins/internal/UnRar.py
+++ b/module/plugins/internal/UnRar.py
@@ -22,7 +22,7 @@ def renice(pid, value):
class UnRar(Extractor):
__name__ = "UnRar"
- __version__ = "1.02"
+ __version__ = "1.03"
__description__ = """Rar extractor plugin"""
__license__ = "GPLv3"
@@ -32,12 +32,13 @@ class UnRar(Extractor):
CMD = "unrar"
# there are some more uncovered rar formats
- re_version = re.compile(r"(UNRAR 5[\d.]+(.*?)freeware)")
- re_splitfile = re.compile(r"(.*)\.part(\d+)\.rar$", re.I)
- re_partfiles = re.compile(r".*\.(rar|r\d+)", re.I)
- re_filelist = re.compile(r"(.+)\s+(\d+)\s+(\d+)\s+")
- re_filelist5 = re.compile(r"(.+)\s+(\d+)\s+\d\d-\d\d-\d\d\s+\d\d:\d\d\s+(.+)")
- re_wrongpwd = re.compile("(Corrupt file or wrong password|password incorrect)", re.I)
+ re_version = re.compile(r'UNRAR 5[\d.]+')
+ re_splitfile = re.compile(r'(.*)\.part(\d+)\.rar$', re.I)
+ re_partfiles = re.compile(r'.*\.(rar|r\d+)$', re.I)
+ re_filelist = re.compile(r'(.+)\s+(\d+)\s+(\d+)\s+')
+ re_filelist5 = re.compile(r'(.+)\s+(\d+)\s+\d\d-\d\d-\d\d\s+\d\d:\d\d\s+(.+)')
+ re_wrongpwd = re.compile(r'Corrupt file or wrong password|password incorrect', re.I)
+ re_wrongcrc = re.compile(r'encrypted|damaged|CRC failed|checksum error', re.I)
@staticmethod
@@ -81,9 +82,9 @@ class UnRar(Extractor):
def init(self):
self.passwordProtected = False
- self.headerProtected = False #: list files will not work without password
- self.smallestFile = None #: small file to test passwords
- self.password = "" #: save the correct password
+ self.headerProtected = False #: list files will not work without password
+ self.smallestFile = None #: small file to test passwords
+ self.password = "" #: save the correct password
def checkArchive(self):
@@ -152,12 +153,15 @@ class UnRar(Extractor):
# retrieve stderr
err = p.stderr.read()
- if "CRC failed" in err and not password and not self.passwordProtected:
- raise CRCError
- elif "CRC failed" in err:
+ if self.re_wrongpwd.search(err):
raise WrongPassword
- if err.strip(): #: raise error if anything is on stderr
+
+ elif self.re_wrongcrc.search(err):
+ raise CRCError
+
+ elif err.strip(): #: raise error if anything is on stderr
raise ArchiveError(err.strip())
+
if p.returncode:
raise ArchiveError("Process terminated")