diff options
Diffstat (limited to 'pyload/plugin/addon')
-rw-r--r-- | pyload/plugin/addon/AntiVirus.py | 14 | ||||
-rw-r--r-- | pyload/plugin/addon/ExtractArchive.py | 24 |
2 files changed, 28 insertions, 10 deletions
diff --git a/pyload/plugin/addon/AntiVirus.py b/pyload/plugin/addon/AntiVirus.py index e2280a0a5..e88dfd0f3 100644 --- a/pyload/plugin/addon/AntiVirus.py +++ b/pyload/plugin/addon/AntiVirus.py @@ -16,7 +16,7 @@ from pyload.utils import fs_encode, fs_join class AntiVirus(Addon): __name = "AntiVirus" __type = "addon" - __version = "0.08" + __version = "0.09" #@TODO: add trash option (use Send2Trash lib) __config = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"), @@ -76,11 +76,19 @@ class AntiVirus(Addon): try: send2trash.send2trash(file) - except Exception: - self.logWarning(_("Unable to move file to trash, move to quarantine instead")) + except NameError: + self.logWarning(_("Send2Trash lib not found, moving to quarantine instead")) pyfile.setCustomStatus(_("file moving")) shutil.move(file, self.getConfig('quardir')) + except Exception, e: + self.logWarning(_("Unable to move file to trash: %s, moving to quarantine instead") % e.message) + pyfile.setCustomStatus(_("file moving")) + shutil.move(file, self.getConfig('quardir')) + + else: + self.logDebug(_("Successfully moved file to trash")) + elif action == "Quarantine": pyfile.setCustomStatus(_("file moving")) shutil.move(file, self.getConfig('quardir')) diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py index 71802cbfe..a2b22e90c 100644 --- a/pyload/plugin/addon/ExtractArchive.py +++ b/pyload/plugin/addon/ExtractArchive.py @@ -113,7 +113,7 @@ class ArchiveQueue(object): class ExtractArchive(Addon): __name = "ExtractArchive" __type = "addon" - __version = "1.42" + __version = "1.44" __config = [("activated" , "bool" , "Activated" , True), ("fullpath" , "bool" , "Extract with full paths" , True), @@ -188,6 +188,11 @@ class ExtractArchive(Addon): @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 @@ -201,6 +206,8 @@ class ExtractArchive(Addon): packages = self.queue.get() #: check for packages added during extraction + self.extracting = False + @Expose def extractPackage(self, *ids): @@ -223,7 +230,7 @@ class ExtractArchive(Addon): def allDownloadsProcessed(self): self.lastPackage = True - if not self.extracting: + if self.getConfig('waitall') and not self.extracting: self.extractQueued() @@ -232,8 +239,6 @@ class ExtractArchive(Addon): if not ids: return False - self.extracting = True - processed = [] extracted = [] failed = [] @@ -375,7 +380,6 @@ class ExtractArchive(Addon): self.queue.remove(pid) - self.extracting = False return True if not failed else False @@ -473,8 +477,14 @@ class ExtractArchive(Addon): try: send2trash.send2trash(file) - except Exception: - self.logWarning(_("Unable to move %s to trash") % os.path.basename(f)) + except NameError: + self.logWarning(_("Unable to move %s to trash: Send2Trash lib not found") % os.path.basename(f)) + + except Exception, e: + self.logWarning(_("Unable to move %s to trash: %s") % (os.path.basename(f), e.message)) + + else: + self.logDebug(_("Successfully moved %s to trash") % os.path.basename(f)) self.logInfo(name, _("Extracting finished")) extracted_files = archive.files or archive.list() |