diff options
Diffstat (limited to 'module/plugins/hooks/ExtractArchive.py')
-rw-r--r-- | module/plugins/hooks/ExtractArchive.py | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index d40b52aa7..05a1e368a 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -6,8 +6,6 @@ import os import sys import traceback -from copy import copy - # monkey patch bug in python 2.6 and lower # http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717 if sys.version_info < (2, 7) and os.name != "nt": @@ -45,6 +43,12 @@ if sys.version_info < (2, 7) and os.name != "nt": subprocess.Popen.wait = wait +try: + import send2trash +except ImportError: + pass + +from copy import copy if os.name != "nt": from grp import getgrnam from pwd import getpwnam @@ -106,7 +110,7 @@ class ArchiveQueue(object): class ExtractArchive(Hook): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.41" + __version__ = "1.42" __config__ = [("activated" , "bool" , "Activated" , True ), ("fullpath" , "bool" , "Extract with full paths" , True ), @@ -150,16 +154,6 @@ class ExtractArchive(Hook): self.passwords = [] self.repair = False - try: - import send2trash - - except ImportError: - self.logDebug("Send2Trash lib not found") - self.trashable = False - - else: - self.trashable = True - def coreReady(self): for p in ("UnRar", "SevenZip", "UnZip"): @@ -474,11 +468,12 @@ class ExtractArchive(Hook): if not deltotrash: os.remove(file) - elif self.trashable: - send2trash.send2trash(file) - else: - self.logWarning(_("Unable to move %s to trash") % os.path.basename(f)) + try: + send2trash.send2trash(file) + + except Exception: + self.logWarning(_("Unable to move %s to trash") % os.path.basename(f)) self.logInfo(name, _("Extracting finished")) extracted_files = archive.files or archive.list() |