diff options
| author | 2015-03-26 10:40:32 +0100 | |
|---|---|---|
| committer | 2015-03-26 10:40:32 +0100 | |
| commit | 329293e0bb0cf4008688d8c73d4b98caa7082141 (patch) | |
| tree | f718ced3338ac170ce47e1ebba72ce2fdd124dcf | |
| parent | interval code cosmetics (diff) | |
| download | pyload-329293e0bb0cf4008688d8c73d4b98caa7082141.tar.xz | |
[Extractor] Rename method 'test' to 'verify'
| -rw-r--r-- | module/plugins/hooks/ExtractArchive.py | 61 | ||||
| -rw-r--r-- | module/plugins/internal/Extractor.py | 4 | ||||
| -rw-r--r-- | module/plugins/internal/SevenZip.py | 4 | ||||
| -rw-r--r-- | module/plugins/internal/UnRar.py | 4 | ||||
| -rw-r--r-- | module/plugins/internal/UnZip.py | 4 | 
5 files changed, 38 insertions, 39 deletions
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 5d71e89ec..c5f842fdd 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -106,24 +106,24 @@ class ArchiveQueue(object):  class ExtractArchive(Hook):      __name__    = "ExtractArchive"      __type__    = "hook" -    __version__ = "1.37" - -    __config__ = [("activated"      , "bool"                , "Activated"                             , True                                                                     ), -                  ("fullpath"       , "bool"                , "Extract with full paths"               , True                                                                     ), -                  ("overwrite"      , "bool"                , "Overwrite files"                       , False                                                                    ), -                  ("keepbroken"     , "bool"                , "Try to extract broken archives"        , False                                                                    ), -                  ("repair"         , "bool"                , "Repair broken archives (RAR required)" , False                                                                    ), -                  ("test"           , "bool"                , "Test archive before extracting"        , False                                                                    ), -                  ("usepasswordfile", "bool"                , "Use password file"                     , True                                                                     ), -                  ("passwordfile"   , "file"                , "Password file"                         , "archive_password.txt"                                                   ), -                  ("delete"         , "No;Permanent;Trash"  , "Delete archive after extraction"       , "No"                                                                     ), -                  ("subfolder"      , "bool"                , "Create subfolder for each package"     , False                                                                    ), -                  ("destination"    , "folder"              , "Extract files to folder"               , ""                                                                       ), -                  ("extensions"     , "str"                 , "Extract archives ending with extension", "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), -                  ("excludefiles"   , "str"                 , "Don't extract the following files"     , "*.nfo,*.DS_Store,index.dat,thumb.db"                                    ), -                  ("recursive"      , "bool"                , "Extract archives in archives"          , True                                                                     ), -                  ("waitall"        , "bool"                , "Run after all downloads was processed" , False                                                                    ), -                  ("renice"         , "int"                 , "CPU priority"                          , 0                                                                        )] +    __version__ = "1.38" + +    __config__ = [("activated"      , "bool"              , "Activated"                             , True                                                                     ), +                  ("fullpath"       , "bool"              , "Extract with full paths"               , True                                                                     ), +                  ("overwrite"      , "bool"              , "Overwrite files"                       , False                                                                    ), +                  ("keepbroken"     , "bool"              , "Try to extract broken archives"        , False                                                                    ), +                  ("repair"         , "bool"              , "Repair broken archives (RAR required)" , False                                                                    ), +                  ("test"           , "bool"              , "Test archive before extracting"        , False                                                                    ), +                  ("usepasswordfile", "bool"              , "Use password file"                     , True                                                                     ), +                  ("passwordfile"   , "file"              , "Password file"                         , "archive_password.txt"                                                   ), +                  ("delete"         , "No;Permanent;Trash", "Delete archive after extraction"       , "No"                                                                     ), +                  ("subfolder"      , "bool"              , "Create subfolder for each package"     , False                                                                    ), +                  ("destination"    , "folder"            , "Extract files to folder"               , ""                                                                       ), +                  ("extensions"     , "str"               , "Extract archives ending with extension", "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), +                  ("excludefiles"   , "str"               , "Don't extract the following files"     , "*.nfo,*.DS_Store,index.dat,thumb.db"                                    ), +                  ("recursive"      , "bool"              , "Extract archives in archives"          , True                                                                     ), +                  ("waitall"        , "bool"              , "Run after all downloads was processed" , False                                                                    ), +                  ("renice"         , "int"               , "CPU priority"                          , 0                                                                        )]      __description__ = """Extract different kind of archives"""      __license__     = "GPLv3" @@ -235,14 +235,14 @@ class ExtractArchive(Hook):          toList = lambda string: string.replace(' ', '').replace(',', '|').replace(';', '|').split('|') -        destination  = self.getConfig('destination') -        subfolder    = self.getConfig('subfolder') -        fullpath     = self.getConfig('fullpath') -        overwrite    = self.getConfig('overwrite') -        renice       = self.getConfig('renice') -        recursive    = self.getConfig('recursive') -        delete       = self.getConfig('delete') -        keepbroken   = self.getConfig('keepbroken') +        destination = self.getConfig('destination') +        subfolder   = self.getConfig('subfolder') +        fullpath    = self.getConfig('fullpath') +        overwrite   = self.getConfig('overwrite') +        renice      = self.getConfig('renice') +        recursive   = self.getConfig('recursive') +        delete      = self.getConfig('delete') +        keepbroken  = self.getConfig('keepbroken')          extensions   = [x.lstrip('.').lower() for x in toList(self.getConfig('extensions'))]          excludefiles = toList(self.getConfig('excludefiles')) @@ -253,8 +253,7 @@ class ExtractArchive(Hook):          # reload from txt file          self.reloadPasswords() -        # dl folder -        dl = self.config['general']['download_folder'] +        download_folder = self.config['general']['download_folder']          # iterate packages -> extractors -> targets          for pid in ids: @@ -267,7 +266,7 @@ class ExtractArchive(Hook):              self.logInfo(_("Check package: %s") % pypack.name)              # determine output folder -            out = save_join(dl, pypack.folder, destination, "")  #: force trailing slash +            out = save_join(download_folder, pypack.folder, destination, "")  #: force trailing slash              if subfolder:                  out = save_join(out, pypack.folder) @@ -277,7 +276,7 @@ class ExtractArchive(Hook):              matched   = False              success   = True -            files_ids = dict((pylink['name'],((save_join(dl, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink \ +            files_ids = dict((pylink['name'],((save_join(download_folder, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink \                          in sorted(pypack.getChildren().itervalues(), key=lambda k: k['name'])).values()  #: remove duplicates              # check as long there are unseen files @@ -390,7 +389,7 @@ class ExtractArchive(Hook):                          if pw:                              self.logDebug("Testing with password: %s" % pw)                          pyfile.setProgress(0) -                        archive.test(pw) +                        archive.verify(pw)                          pyfile.setProgress(100)                      else:                          archive.check(pw) diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index ec6a4e175..159b65ffe 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -20,7 +20,7 @@ class PasswordError(Exception):  class Extractor:      __name__    = "Extractor" -    __version__ = "0.23" +    __version__ = "0.24"      __description__ = """Base extractor plugin"""      __license__     = "GPLv3" @@ -109,7 +109,7 @@ class Extractor:          """          raise NotImplementedError -    def test(self): +    def verify(self):          """Testing with Extractors buildt-in method          Raises error if password is needed, integrity is questionable or else. diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index 482b1802c..624f6c939 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -10,7 +10,7 @@ from module.utils import fs_encode, save_join  class SevenZip(UnRar):      __name__    = "SevenZip" -    __version__ = "0.10" +    __version__ = "0.11"      __description__ = """7-Zip extractor plugin"""      __license__     = "GPLv3" @@ -52,7 +52,7 @@ class SevenZip(UnRar):          return True -    def test(self, password): +    def verify(self, password):          # 7z can't distinguish crc and pw error in test          p = self.call_cmd("l", "-slt", fs_encode(self.filename))          out, err = p.communicate() diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 75c192bac..5b9f2e1c3 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -22,7 +22,7 @@ def renice(pid, value):  class UnRar(Extractor):      __name__    = "UnRar" -    __version__ = "1.19" +    __version__ = "1.20"      __description__ = """Rar extractor plugin"""      __license__     = "GPLv3" @@ -83,7 +83,7 @@ class UnRar(Extractor):          return True if cls.re_multipart.search(filename) else False -    def test(self, password): +    def verify(self, password):          p = self.call_cmd("t", "-v", fs_encode(self.filename), password=password)          self._progress(p)          err = p.stderr.read().strip() diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py index d95afbc70..8d3fec370 100644 --- a/module/plugins/internal/UnZip.py +++ b/module/plugins/internal/UnZip.py @@ -12,7 +12,7 @@ from module.utils import fs_encode  class UnZip(Extractor):      __name__    = "UnZip" -    __version__ = "1.11" +    __version__ = "1.12"      __description__ = """Zip extractor plugin"""      __license__     = "GPLv3" @@ -38,7 +38,7 @@ class UnZip(Extractor):          pass -    def test(self): +    def verify(self):          with zipfile.ZipFile(fs_encode(self.filename), 'r', allowZip64=True) as z:              badfile = z.testzip()  | 
