From 8483aacbcd7f3f4c6ad92ef2255b449b88d64a35 Mon Sep 17 00:00:00 2001
From: GammaC0de <GammaC0de@users.noreply.github.com>
Date: Tue, 5 May 2015 01:23:31 +0300
Subject: fix bug causing `extractQueued` called twice

---
 module/plugins/hooks/ExtractArchive.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'module')

diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index 05a1e368a..62eb36714 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -187,6 +187,11 @@ class ExtractArchive(Hook):
 
     @threaded
     def extractQueued(self, thread):
+        if self.extracting:  #@NOTE: doing the check here for safty (called by coreReady)
+            return
+
+        self.extracting = True
+
         packages = self.queue.get()
         while packages:
             if self.lastPackage:  #: called from allDownloadsProcessed
@@ -200,6 +205,8 @@ class ExtractArchive(Hook):
 
             packages = self.queue.get()  #: check for packages added during extraction
 
+        self.extracting = False
+
 
     @Expose
     def extractPackage(self, *ids):
@@ -222,7 +229,7 @@ class ExtractArchive(Hook):
 
     def allDownloadsProcessed(self):
         self.lastPackage = True
-        if not self.extracting:
+        if self.getConfig('waitall') and not self.extracting:
             self.extractQueued()
 
 
@@ -231,8 +238,6 @@ class ExtractArchive(Hook):
         if not ids:
             return False
 
-        self.extracting = True
-
         processed = []
         extracted = []
         failed    = []
@@ -374,7 +379,6 @@ class ExtractArchive(Hook):
 
             self.queue.remove(pid)
 
-        self.extracting = False
         return True if not failed else False
 
 
-- 
cgit v1.2.3


From e3d3ad079d8af1806a475020aeb7e9fdc5a26600 Mon Sep 17 00:00:00 2001
From: GammaC0de <GammaC0de@users.noreply.github.com>
Date: Tue, 5 May 2015 01:33:17 +0300
Subject: Update ExtractArchive.py

---
 module/plugins/hooks/ExtractArchive.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'module')

diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index 62eb36714..bd8153a73 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -110,7 +110,7 @@ class ArchiveQueue(object):
 class ExtractArchive(Hook):
     __name__    = "ExtractArchive"
     __type__    = "hook"
-    __version__ = "1.42"
+    __version__ = "1.43"
 
     __config__ = [("activated"      , "bool"              , "Activated"                                 , True                                                                     ),
                   ("fullpath"       , "bool"              , "Extract with full paths"                   , True                                                                     ),
-- 
cgit v1.2.3