diff options
Diffstat (limited to 'module/plugins/hooks/ExtractArchive.py')
-rw-r--r-- | module/plugins/hooks/ExtractArchive.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 6d559bfcb..b9e6842cf 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -277,15 +277,15 @@ class ExtractArchive(Addon): matched = False success = True - files_ids = dict((fdata['name'], ((fsjoin(dl_folder, pypack.folder, fdata['name'])), fid, out)) for fid, fdata \ - in sorted(pypack.getChildren().values(), key=lambda k: k['name'])).items() #: Remove duplicates + files_ids = dict((fdata['name'], (fdata['id'], (fsjoin(dl_folder, pypack.folder, fdata['name'])), out)) for fdata \ + in pypack.getChildren().values()).values() #: Remove duplicates #: Check as long there are unseen files while files_ids: new_files_ids = [] if extensions: - files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids \ + files_ids = [(fid, fname, fout) for fid, fname, fout in files_ids \ if filter(lambda ext: fname.lower().endswith(ext), extensions)] for Extractor in self.extractors: @@ -294,7 +294,7 @@ class ExtractArchive(Addon): self.log_debug("Targets for %s: %s" % (Extractor.__name__, targets)) matched = True - for fname, fid, fout in targets: + for fid, fname, fout in targets: name = os.path.basename(fname) if not exists(fname): @@ -304,15 +304,14 @@ class ExtractArchive(Addon): self.log_info(name, _("Extract to: %s") % fout) try: pyfile = self.pyload.files.getFile(fid) - archive = Extractor(self, + archive = Extractor(pyfile, fname, fout, fullpath, overwrite, excludefiles, priority, - keepbroken, - fid) + keepbroken) thread.addActive(pyfile) archive.init() @@ -330,12 +329,12 @@ class ExtractArchive(Addon): continue #: Remove processed file and related multiparts from list - files_ids = [(fname, fid, fout) for fname, fid, fout in files_ids \ + files_ids = [(fid, fname, fout) for fid, fname, fout in files_ids \ if fname not in archive.items()] self.log_debug("Extracted files: %s" % new_files) - for file in new_files: - self.set_permissions(file) + for filename in new_files: + self.set_permissions(filename) for filename in new_files: file = encode(fsjoin(os.path.dirname(archive.filename), filename)) @@ -344,7 +343,7 @@ class ExtractArchive(Addon): continue if recursive and os.path.isfile(file): - new_files_ids.append((filename, fid, os.path.dirname(filename))) #: Append as new target + new_files_ids.append((fid, filename, os.path.dirname(filename))) #: Append as new target self.manager.dispatchEvent("archive_extracted", pyfile, archive) @@ -447,7 +446,7 @@ class ExtractArchive(Addon): pyfile.setProgress(100) pyfile.setStatus("processing") - delfiles = archive.items() + delfiles = archive.chunks() self.log_debug("Would delete: " + ", ".join(delfiles)) if self.config.get('delete'): |