[job] add 'keywords-global' option (#6582)

https://github.com/mikf/gallery-dl/issues/6582#issuecomment-3505732704
This commit is contained in:
Mike Fährmann
2025-11-12 18:48:01 +01:00
parent d7e1351987
commit 691775d0fb
3 changed files with 25 additions and 8 deletions

View File

@@ -958,6 +958,17 @@ Description
Additional name-value pairs to be added to each metadata dictionary.
extractor.*.keywords-default
----------------------------
Type
any
Default
``"None"``
Description
Default value used for missing or undefined keyword names in a
`Format String`_.
extractor.*.keywords-eval
-------------------------
Type
@@ -969,15 +980,18 @@ Description
as a `Format String`_.
extractor.*.keywords-default
----------------------------
extractor.*.keywords-global
---------------------------
Type
any
Default
``"None"``
``object`` (`name``value`)
Example
``{"type": "Original", "type_id": 1, "type_category": "meta"}``
Description
Default value used for missing or undefined keyword names in a
`Format String`_.
Global name-value pairs to be added to each metadata dictionary.
Note
Keywords defined here will be overwritten by keywords from
`extractor.keywords <extractor.*.keywords_>`__
with the same name.
extractor.*.metadata-url

View File

@@ -52,8 +52,9 @@
"chapter-unique": false,
"keywords" : {},
"keywords-eval" : false,
"keywords-default" : null,
"keywords-eval" : false,
"keywords-global" : {},
"parent-directory": false,
"parent-metadata" : false,

View File

@@ -87,6 +87,8 @@ class Job():
"current_git_head": util.git_head()
}
# user-supplied metadata
if kwdict := extr.config("keywords-global"):
self.kwdict.update(kwdict)
if kwdict := extr.config("keywords"):
if extr.config("keywords-eval"):
self.kwdict_eval = []