Skip to content

Commit

Permalink
[postprocessor:metadata] add 'private' option
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Nov 20, 2022
1 parent a24dcbe commit 6b97dcf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
11 changes: 11 additions & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3768,6 +3768,17 @@ Description
See the ``mode`` parameter of |open()|_ for further details.


metadata.private
----------------
Type
``bool``
Default
``false``
Description
Include private fields,
i.e. fields whose name starts with an underscore.


metadata.encoding
-----------------
Type
Expand Down
5 changes: 4 additions & 1 deletion gallery_dl/postprocessor/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def __init__(self, job, options):
self.mtime = options.get("mtime")
self.omode = options.get("open", omode)
self.encoding = options.get("encoding", "utf-8")
self.private = options.get("private", False)

def run(self, pathfmt):
archive = self.archive
Expand Down Expand Up @@ -209,7 +210,9 @@ def _write_tags(self, fp, kwdict):
fp.write("\n".join(tags) + "\n")

def _write_json(self, fp, kwdict):
util.dump_json(util.filter_dict(kwdict), fp, self.ascii, self.indent)
if not self.private:
kwdict = util.filter_dict(kwdict)
util.dump_json(kwdict, fp, self.ascii, self.indent)


__postprocessor__ = MetadataPP

0 comments on commit 6b97dcf

Please sign in to comment.