From 0df373e5da9d33e4dea3e709521d4883ef7f9b45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jens=20H=C3=B6rnlein?= <jens.hoernlein@googlemail.com>
Date: Wed, 4 Feb 2015 20:41:03 +0100
Subject: [Unrar] Fix: Deleting All Files after Extraction

---
 module/plugins/hooks/ExtractArchive.py | 8 ++++----
 module/plugins/internal/UnRar.py       | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

(limited to 'module/plugins')

diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index e1c05878c..e1d6dff59 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -276,16 +276,16 @@ class ExtractArchive(Hook):
                     for fname, fid in targets:
                         name = os.path.basename(fname)
 
-                        if not os.path.exists(fname):
-                            self.logDebug(name, "File not found")
-                            continue
-
                         pname = replace_patterns(fname, self.NAME_REPLACEMENTS)
                         if pname not in processed:
                             processed.append(pname)  #: prevent extracting same file twice
                         else:
                             self.logDebug(name, "Skipped")
                             continue
+                            
+                        if not os.path.exists(fname):
+                            self.logDebug(name, "File not found")
+                            continue
 
                         self.logInfo(name, _("Extract to: %s") % out)
                         try:
diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py
index 7126c960b..81cfb38a7 100644
--- a/module/plugins/internal/UnRar.py
+++ b/module/plugins/internal/UnRar.py
@@ -167,7 +167,7 @@ class UnRar(Extractor):
             try:
                 dir, name = os.path.split(self.filename)
 
-                part     = self.getattr(self, "re_rarpart%d" % i).search(name).group(1)
+                part     = getattr(self, "re_rarpart%d" % i).search(name).group(1)
                 new_name = name[::-1].replace((".part%s.rar" % part)[::-1], ".part*.rar"[::-1], 1)[::-1]
                 file     = fs_encode(os.path.join(dir, new_name))
 
-- 
cgit v1.2.3