Skip to content

Commit

Permalink
[postprocessor:metadata] rename 'format' to 'content-format'
Browse files Browse the repository at this point in the history
Just to be consistent with the other 'extension-format' option name,
and only 'format' is also still accepted.
  • Loading branch information
mikf committed Nov 30, 2019
1 parent a412531 commit 26d2334
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1465,8 +1465,8 @@ Description Select how to write metadata.
* ``"json"``: all metadata using `json.dump()
<https://docs.python.org/3/library/json.html#json.dump>`_
* ``"tags"``: ``tags`` separated by newlines
* ``"custom"``: result of applying `metadata.format`_ to a file's
metadata dictionary
* ``"custom"``: result of applying `metadata.content-format`_
to a file's metadata dictionary
=========== =====

metadata.extension
Expand All @@ -1490,8 +1490,8 @@ Description Custom format string to build filename extensions for metadata
Note: `metadata.extension`_ is ignored if this option is set.
=========== =====

metadata.format
---------------
metadata.content-format
-----------------------
=========== =====
Type ``string``
Example ``"tags:\n\n{tags:J\n}\n"``
Expand Down
3 changes: 2 additions & 1 deletion gallery_dl/postprocessor/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def __init__(self, pathfmt, options):
mode = options.get("mode", "json")
if mode == "custom":
self.write = self._write_custom
self.contentfmt = util.Formatter(options.get("format")).format_map
cfmt = options.get("content-format") or options.get("format")
self.contentfmt = util.Formatter(cfmt).format_map
ext = "txt"
elif mode == "tags":
self.write = self._write_tags
Expand Down

0 comments on commit 26d2334

Please sign in to comment.