diff options
Diffstat (limited to 'module/plugins/hooks/ExtractArchive.py')
-rw-r--r-- | module/plugins/hooks/ExtractArchive.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 53f88b3a5..12bd40d1b 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -24,7 +24,8 @@ if sys.version_info < (2, 7) and os.name != "nt": continue raise - def wait(self): + # unsued timeout option for older python version + def wait(self, timeout=0): """Wait for child process to terminate. Returns returncode attribute.""" if self.returncode is None: @@ -56,7 +57,7 @@ class ExtractArchive(Hook): Provides: unrarFinished (folder, filename) """ __name__ = "ExtractArchive" - __version__ = "0.1" + __version__ = "0.12" __description__ = "Extract different kind of archives" __config__ = [("activated", "bool", "Activated", True), ("fullpath", "bool", "Extract full path", True), @@ -65,7 +66,8 @@ class ExtractArchive(Hook): ("deletearchive", "bool", "Delete archives when done", False), ("subfolder", "bool", "Create subfolder for each package", False), ("destination", "folder", "Extract files to", ""), - ("queue", "bool", "Wait for all downloads to be fninished", True), + ("recursive", "bool", "Extract archives in archvies", True), + ("queue", "bool", "Wait for all downloads to be finished", True), ("renice", "int", "CPU Priority", 0), ] __author_name__ = ("pyload Team") __author_mail__ = ("admin<at>pyload.org") @@ -157,6 +159,7 @@ class ExtractArchive(Hook): makedirs(out) files_ids = [(save_join(dl, p.folder, x["name"]), x["id"]) for x in p.getChildren().itervalues()] + matched = False # check as long there are unseen files while files_ids: @@ -164,7 +167,9 @@ class ExtractArchive(Hook): for plugin in self.plugins: targets = plugin.getTargets(files_ids) - if targets: self.logDebug("Targets for %s: %s" % (plugin.__name__, targets)) + if targets: + self.logDebug("Targets for %s: %s" % (plugin.__name__, targets)) + matched = True for target, fid in targets: if target in extracted: self.logDebug(basename(target), "skipped") @@ -184,11 +189,14 @@ class ExtractArchive(Hook): if not exists(file): self.logDebug("new file %s does not exists" % file) continue - if isfile(file): + if self.getConfig("recursive") and isfile(file): new_files_ids.append((file, fid)) #append as new target files_ids = new_files_ids # also check extracted files + if not matched: self.logInfo(_("No files found to extract")) + + def startExtracting(self, plugin, fid, passwords, thread): pyfile = self.core.files.getFile(fid) @@ -303,4 +311,4 @@ class ExtractArchive(Hook): gid = getgrnam(self.config["permission"]["group"])[2] chown(f, uid, gid) except Exception, e: - self.log.warning(_("Setting User and Group failed"), e)
\ No newline at end of file + self.log.warning(_("Setting User and Group failed"), e) |