From 2e4aaa2258635a3366d5b1dc34a0ea81a1935136 Mon Sep 17 00:00:00 2001
From: Ben White <bepix@users.noreply.github.com>
Date: Sat, 29 Mar 2014 22:44:45 +0100
Subject: Unrar 5.x Support Merged #567

(cherry picked from commit c768ad07f53c4109d5cb894f3e9194bfd4c37857)
---
 pyload/plugins/internal/UnRar.py | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/pyload/plugins/internal/UnRar.py b/pyload/plugins/internal/UnRar.py
index 8635483e6..c088c147d 100644
--- a/pyload/plugins/internal/UnRar.py
+++ b/pyload/plugins/internal/UnRar.py
@@ -29,12 +29,14 @@ from module.plugins.internal.AbstractExtractor import AbtractExtractor, WrongPas
 
 class UnRar(AbtractExtractor):
     __name__ = "UnRar"
-    __version__ = "0.14"
+    __version__ = "0.15"
 
     # 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[0-9]+)", 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)
     CMD = "unrar"
 
@@ -90,10 +92,16 @@ class UnRar(AbtractExtractor):
             return True
 
         # output only used to check if passworded files are present
-        for name, size, packed in  self.re_filelist.findall(out):
-            if name.startswith("*"):
-                self.passwordProtected = True
-                return True
+        if self.re_version.search(out):
+            for attr, size, name in  self.re_filelist5.findall(out):
+                if attr.startswith("*"):
+                    self.passwordProtected = True
+                    return True
+        else:
+            for name, size, packed in  self.re_filelist.findall(out):
+                if name.startswith("*"):
+                    self.passwordProtected = True
+                    return True
 
         self.listContent()
         if not self.files:
-- 
cgit v1.2.3