diff options
Diffstat (limited to 'gallery_dl/job.py')
| -rw-r--r-- | gallery_dl/job.py | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/gallery_dl/job.py b/gallery_dl/job.py index 30801ee..c41f382 100644 --- a/gallery_dl/job.py +++ b/gallery_dl/job.py @@ -551,9 +551,15 @@ class DownloadJob(Job): archive_path = cfg("archive") if archive_path: archive_path = util.expand_path(archive_path) - archive_format = (cfg("archive-prefix", extr.category) + - cfg("archive-format", extr.archive_fmt)) - archive_pragma = (cfg("archive-pragma")) + + archive_prefix = cfg("archive-prefix") + if archive_prefix is None: + archive_prefix = extr.category + + archive_format = cfg("archive-format") + if archive_format is None: + archive_format = extr.archive_fmt + try: if "{" in archive_path: archive_path = formatter.parse( @@ -563,7 +569,10 @@ class DownloadJob(Job): else: archive_cls = archive.DownloadArchive self.archive = archive_cls( - archive_path, archive_format, archive_pragma) + archive_path, + archive_prefix + archive_format, + cfg("archive-pragma"), + ) except Exception as exc: extr.log.warning( "Failed to open download archive at '%s' (%s: %s)", @@ -598,7 +607,7 @@ class DownloadJob(Job): skip_filter = cfg("skip-filter") if skip_filter: - self._skipftr = util.compile_expression(skip_filter) + self._skipftr = util.compile_filter(skip_filter) else: self._skipftr = None else: @@ -622,6 +631,14 @@ class DownloadJob(Job): for pp_dict in postprocessors: if isinstance(pp_dict, str): pp_dict = pp_conf.get(pp_dict) or {"name": pp_dict} + elif "type" in pp_dict: + pp_type = pp_dict["type"] + if pp_type in pp_conf: + pp = pp_conf[pp_type].copy() + pp.update(pp_dict) + pp_dict = pp + if "name" not in pp_dict: + pp_dict["name"] = pp_type if pp_opts: pp_dict = pp_dict.copy() pp_dict.update(pp_opts) @@ -660,7 +677,7 @@ class DownloadJob(Job): expr = options.get("filter") if options else None if expr: - condition = util.compile_expression(expr) + condition = util.compile_filter(expr) for hook, callback in hooks.items(): self.hooks[hook].append(functools.partial( self._call_hook, callback, condition)) |
