mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 04:02:32 +01:00
add option to specify additional key-value pairs
This commit is contained in:
parent
d38bf2f54c
commit
7f7c16ae37
@ -344,6 +344,15 @@ Description User-Agent header value to be used for HTTP requests.
|
||||
=========== =====
|
||||
|
||||
|
||||
extractor.*.keywords
|
||||
--------------------
|
||||
=========== =====
|
||||
Type ``object``
|
||||
Example ``{"type": "Pixel Art", "type_id": 123}``
|
||||
Description Additional key-value pairs to be added to each metadata dictionary.
|
||||
=========== =====
|
||||
|
||||
|
||||
Extractor-specific Options
|
||||
==========================
|
||||
|
||||
|
@ -100,7 +100,7 @@ def parse_inputfile(file):
|
||||
continue
|
||||
|
||||
elif line[0] == "{":
|
||||
# url-specfic config spec
|
||||
# url-specific config spec
|
||||
try:
|
||||
cfd = json.loads(line)
|
||||
except ValueError as exc:
|
||||
|
@ -52,6 +52,9 @@ class Job():
|
||||
self.extractor.category = parent.extractor.category
|
||||
self.extractor.subcategory = parent.extractor.subcategory
|
||||
|
||||
# user-supplied metadata
|
||||
self.userkwds = self.extractor.config("keywords")
|
||||
|
||||
def run(self):
|
||||
"""Execute or run the job"""
|
||||
try:
|
||||
@ -133,9 +136,11 @@ class Job():
|
||||
"""Handle Message.Queue"""
|
||||
|
||||
def update_kwdict(self, kwdict):
|
||||
"""Add 'category' and 'subcategory' keywords"""
|
||||
"""Update 'kwdict' with additional metadata"""
|
||||
kwdict["category"] = self.extractor.category
|
||||
kwdict["subcategory"] = self.extractor.subcategory
|
||||
if self.userkwds:
|
||||
kwdict.update(self.userkwds)
|
||||
|
||||
def _write_unsupported(self, url):
|
||||
if self.ufile:
|
||||
|
Loading…
Reference in New Issue
Block a user