diff options
Diffstat (limited to 'pyload/plugin/addon/ExtractArchive.py')
| -rw-r--r-- | pyload/plugin/addon/ExtractArchive.py | 29 | 
1 files changed, 12 insertions, 17 deletions
| diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py index 616334af2..71802cbfe 100644 --- a/pyload/plugin/addon/ExtractArchive.py +++ b/pyload/plugin/addon/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": @@ -48,6 +46,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 @@ -109,7 +113,7 @@ class ArchiveQueue(object):  class ExtractArchive(Addon):      __name    = "ExtractArchive"      __type    = "addon" -    __version = "1.41" +    __version = "1.42"      __config = [("activated"      , "bool"              , "Activated"                                 , True),                  ("fullpath"       , "bool"              , "Extract with full paths"                   , True), @@ -151,16 +155,6 @@ class ExtractArchive(Addon):          self.passwords   = []          self.repair      = False -        try: -            import send2trash - -        except ImportError: -            self.logDebug("Send2Trash lib not found") -            self.trashable = False - -        else: -            self.trashable = True -      def activate(self):          for p in ("UnRar", "SevenZip", "UnZip"): @@ -475,11 +469,12 @@ class ExtractArchive(Addon):                      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() | 
