add 'metadata-extractor' option (#4549)

This commit is contained in:
Mike Fährmann
2023-11-20 22:16:15 +01:00
parent 34a387b6e2
commit aea15f6d17
2 changed files with 20 additions and 4 deletions

View File

@@ -675,6 +675,18 @@ Description
to access the current file's filename as ``"{gdl_path.filename}"``.
extractor.*.metadata-extractor
------------------------------
extractor.*.extractor-metadata
------------------------------
Type
``string``
Description
Insert a reference to the current
`Extractor <https://github.com/mikf/gallery-dl/blob/v1.26.2/gallery_dl/extractor/common.py#L26>`__
object into metadata dictionaries as the given name.
extractor.*.metadata-http
-------------------------
extractor.*.http-metadata

View File

@@ -91,19 +91,23 @@ class Job():
self.metadata_http = extr.config2("metadata-http", "http-metadata")
metadata_path = extr.config2("metadata-path", "path-metadata")
metadata_version = extr.config2("metadata-version", "version-metadata")
metadata_extractor = extr.config2(
"metadata-extractor", "extractor-metadata")
# user-supplied metadata
kwdict = extr.config("keywords")
if kwdict:
self.kwdict.update(kwdict)
if metadata_path:
self.kwdict[metadata_path] = path_proxy
if metadata_extractor:
self.kwdict[metadata_extractor] = extr
if metadata_version:
self.kwdict[metadata_version] = {
"version" : version.__version__,
"is_executable" : util.EXECUTABLE,
"current_git_head": util.git_head()
}
# user-supplied metadata
kwdict = extr.config("keywords")
if kwdict:
self.kwdict.update(kwdict)
def run(self):
"""Execute or run the job"""