add option to specify additional key-value pairs

pull/79/head
Mike Fährmann 7 years ago
parent d38bf2f54c
commit 7f7c16ae37
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -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…
Cancel
Save