diff options
Diffstat (limited to 'module/plugins/hooks/ExtractArchive.py')
-rw-r--r-- | module/plugins/hooks/ExtractArchive.py | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index c001000c8..96c8d7ed3 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -51,7 +51,7 @@ except ImportError: from module.plugins.internal.Addon import Addon, Expose, threaded from module.plugins.internal.Extractor import ArchiveError, CRCError, PasswordError -from module.plugins.internal.utils import encode, exists, fs_join, replace_patterns, uniqify +from module.plugins.internal.misc import encode, exists, fsjoin, replace_patterns, uniqify class ArchiveQueue(object): @@ -98,7 +98,7 @@ class ArchiveQueue(object): class ExtractArchive(Addon): __name__ = "ExtractArchive" __type__ = "hook" - __version__ = "1.53" + __version__ = "1.54" __status__ = "testing" __config__ = [("activated" , "bool" , "Activated" , True ), @@ -149,7 +149,7 @@ class ExtractArchive(Addon): if klass.find(): self.extractors.append(klass) if klass.REPAIR: - self.repair = self.get_config('repair') + self.repair = self.config.get('repair') except OSError, e: if e.errno == 2: @@ -206,7 +206,7 @@ class ExtractArchive(Addon): """ for id in ids: self.queue.add(id) - if not self.get_config('waitall') and not self.extracting: + if not self.config.get('waitall') and not self.extracting: self.extract_queued() @@ -216,13 +216,13 @@ class ExtractArchive(Addon): def package_finished(self, pypack): self.queue.add(pypack.id) - if not self.get_config('waitall') and not self.extracting: + if not self.config.get('waitall') and not self.extracting: self.extract_queued() def all_downloads_processed(self): self.last_package = True - if self.get_config('waitall') and not self.extracting: + if self.config.get('waitall') and not self.extracting: self.extract_queued() @@ -237,16 +237,16 @@ class ExtractArchive(Addon): toList = lambda string: string.replace(' ', '').replace(',', '|').replace(';', '|').split('|') - destination = self.get_config('destination') - subfolder = self.get_config('subfolder') - fullpath = self.get_config('fullpath') - overwrite = self.get_config('overwrite') - priority = self.get_config('priority') - recursive = self.get_config('recursive') - keepbroken = self.get_config('keepbroken') + destination = self.config.get('destination') + subfolder = self.config.get('subfolder') + fullpath = self.config.get('fullpath') + overwrite = self.config.get('overwrite') + priority = self.config.get('priority') + recursive = self.config.get('recursive') + keepbroken = self.config.get('keepbroken') - extensions = [x.lstrip('.').lower() for x in toList(self.get_config('extensions'))] - excludefiles = toList(self.get_config('excludefiles')) + extensions = [x.lstrip('.').lower() for x in toList(self.config.get('extensions'))] + excludefiles = toList(self.config.get('excludefiles')) if extensions: self.log_debug("Use for extensions: %s" % "|.".join(extensions)) @@ -267,17 +267,17 @@ class ExtractArchive(Addon): self.log_info(_("Check package: %s") % pypack.name) #: Determine output folder - out = fs_join(dl_folder, pypack.folder, destination, "") #: Force trailing slash + out = fsjoin(dl_folder, pypack.folder, destination, "") #: Force trailing slash if subfolder: - out = fs_join(out, pypack.folder) + out = fsjoin(out, pypack.folder) if not exists(out): os.makedirs(out) matched = False success = True - files_ids = dict((pylink['name'], ((fs_join(dl_folder, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink \ + files_ids = dict((pylink['name'], ((fsjoin(dl_folder, pypack.folder, pylink['name'])), pylink['id'], out)) for pylink \ in sorted(pypack.getChildren().values(), key=lambda k: k['name'])).values() #: Remove duplicates #: Check as long there are unseen files @@ -338,7 +338,7 @@ class ExtractArchive(Addon): self.set_permissions(file) for filename in new_files: - file = encode(fs_join(os.path.dirname(archive.filename), filename)) + file = encode(fsjoin(os.path.dirname(archive.filename), filename)) if not exists(file): self.log_debug("New file %s does not exists" % filename) continue @@ -383,7 +383,7 @@ class ExtractArchive(Addon): encrypted = False try: self.log_debug("Password: %s" % (password or "None provided")) - passwords = uniqify([password] + self.get_passwords(False)) if self.get_config('usepasswordfile') else [password] + passwords = uniqify([password] + self.get_passwords(False)) if self.config.get('usepasswordfile') else [password] for pw in passwords: try: pyfile.setCustomStatus(_("archive testing")) @@ -410,7 +410,7 @@ class ExtractArchive(Addon): repaired = archive.repair() pyfile.setProgress(100) - if not repaired and not self.get_config('keepbroken'): + if not repaired and not self.config.get('keepbroken'): raise CRCError("Archive damaged") else: @@ -427,7 +427,7 @@ class ExtractArchive(Addon): pyfile.setCustomStatus(_("archive extracting")) pyfile.setProgress(0) - if not encrypted or not self.get_config('usepasswordfile'): + if not encrypted or not self.config.get('usepasswordfile'): self.log_debug("Extracting using password: %s" % (password or "None")) archive.extract(password) else: @@ -450,10 +450,10 @@ class ExtractArchive(Addon): delfiles = archive.items() self.log_debug("Would delete: " + ", ".join(delfiles)) - if self.get_config('delete'): + if self.config.get('delete'): self.log_info(_("Deleting %s files") % len(delfiles)) - deltotrash = self.get_config('deltotrash') + deltotrash = self.config.get('deltotrash') for f in delfiles: file = encode(f) if not exists(file): @@ -523,7 +523,7 @@ class ExtractArchive(Addon): try: passwords = [] - file = encode(self.get_config('passwordfile')) + file = encode(self.config.get('passwordfile')) with open(file) as f: for pw in f.read().splitlines(): passwords.append(pw) @@ -552,7 +552,7 @@ class ExtractArchive(Addon): try: self.passwords = uniqify([password] + self.passwords) - file = encode(self.get_config('passwordfile')) + file = encode(self.config.get('passwordfile')) with open(file, "wb") as f: for pw in self.passwords: f.write(pw + '\n') |