diff --git a/gallery_dl/job.py b/gallery_dl/job.py index 3a59718b..dddc03af 100644 --- a/gallery_dl/job.py +++ b/gallery_dl/job.py @@ -376,17 +376,17 @@ class DownloadJob(Job): def initialize(self, kwdict=None): """Delayed initialization of PathFormat, etc.""" - config = self.extractor.config + cfg = self.extractor.config pathfmt = self.pathfmt = util.PathFormat(self.extractor) if kwdict: pathfmt.set_directory(kwdict) - self.sleep = config("sleep") - if not config("download", True): + self.sleep = cfg("sleep") + if not cfg("download", True): # monkey-patch method to do nothing and always return True self.download = pathfmt.fix_extension - archive = config("archive") + archive = cfg("archive") if archive: path = util.expand_path(archive) try: @@ -400,7 +400,7 @@ class DownloadJob(Job): else: self.extractor.log.debug("Using download archive '%s'", path) - skip = config("skip", True) + skip = cfg("skip", True) if skip: self._skipexc = None if skip == "enumerate": @@ -428,7 +428,10 @@ class DownloadJob(Job): category = self.extractor.category basecategory = self.extractor.basecategory + pp_conf = config.get((), "postprocessor") or {} for pp_dict in postprocessors: + if isinstance(pp_dict, str): + pp_dict = pp_conf.get(pp_dict) or {"name": pp_dict} whitelist = pp_dict.get("whitelist") if whitelist and category not in whitelist and \ diff --git a/gallery_dl/option.py b/gallery_dl/option.py index 6018542e..b1469452 100644 --- a/gallery_dl/option.py +++ b/gallery_dl/option.py @@ -335,7 +335,7 @@ def build_parser(): postprocessor.add_argument( "--zip", dest="postprocessors", - action="append_const", const={"name": "zip"}, + action="append_const", const="zip", help="Store downloaded files in a ZIP archive", ) postprocessor.add_argument( @@ -362,7 +362,7 @@ def build_parser(): postprocessor.add_argument( "--write-metadata", dest="postprocessors", - action="append_const", const={"name": "metadata"}, + action="append_const", const="metadata", help="Write metadata to separate JSON files", ) postprocessor.add_argument( @@ -374,7 +374,7 @@ def build_parser(): postprocessor.add_argument( "--mtime-from-date", dest="postprocessors", - action="append_const", const={"name": "mtime"}, + action="append_const", const="mtime", help="Set file modification times according to 'date' metadata", ) postprocessor.add_argument(