[common] use 'parent' value as 'parent-metadata' default (#8525 #8604)

enable 'parent-metadata' by default for
'chevereto' & 'imagehost' (album/gallery) extractors
This commit is contained in:
Mike Fährmann
2025-12-08 20:07:56 +01:00
parent f5f4122cb6
commit b1b70528a6
6 changed files with 20 additions and 3 deletions

View File

@@ -231,10 +231,13 @@ Type
* ``bool`` * ``bool``
* ``string`` * ``string``
Default Default
``true``
``[chevereto]`` |
``[imagehost]``
``false`` ``false``
otherwise
Description Description
If ``true``, overwrite any metadata provided by a child extractor Forward a parent's metadata to its child extractors.
with its parent's.
| If this is a ``string``, add a parent's metadata to its children's | If this is a ``string``, add a parent's metadata to its children's
to a field named after said string. to a field named after said string.

View File

@@ -1007,6 +1007,11 @@
"videos" : true "videos" : true
}, },
"chevereto":
{
"parent-metadata": true
},
"Danbooru": "Danbooru":
{ {
"sleep-request": "0.5-1.5", "sleep-request": "0.5-1.5",
@@ -1076,6 +1081,11 @@
"referer": false "referer": false
}, },
"imagehost":
{
"parent-metadata": true
},
"mastodon": "mastodon":
{ {
"access-token": null, "access-token": null,

View File

@@ -17,6 +17,7 @@ class CheveretoExtractor(BaseExtractor):
basecategory = "chevereto" basecategory = "chevereto"
directory_fmt = ("{category}", "{user}", "{album}") directory_fmt = ("{category}", "{user}", "{album}")
archive_fmt = "{id}" archive_fmt = "{id}"
parent = True
def _init(self): def _init(self):
self.path = self.groups[-1] self.path = self.groups[-1]

View File

@@ -33,6 +33,7 @@ class Extractor():
basecategory = "" basecategory = ""
basesubcategory = "" basesubcategory = ""
categorytransfer = False categorytransfer = False
parent = False
directory_fmt = ("{category}",) directory_fmt = ("{category}",)
filename_fmt = "{filename}.{extension}" filename_fmt = "{filename}.{extension}"
archive_fmt = "" archive_fmt = ""

View File

@@ -19,6 +19,7 @@ class ImagehostImageExtractor(Extractor):
basecategory = "imagehost" basecategory = "imagehost"
subcategory = "image" subcategory = "image"
archive_fmt = "{token}" archive_fmt = "{token}"
parent = True
_https = True _https = True
_params = None _params = None
_cookies = None _cookies = None

View File

@@ -452,7 +452,8 @@ class DownloadJob(Job):
else: else:
extr._parentdir = pextr._parentdir extr._parentdir = pextr._parentdir
if pmeta := pextr.config2("parent-metadata", "metadata-parent"): if pmeta := pextr.config2(
"parent-metadata", "metadata-parent", pextr.parent):
if isinstance(pmeta, str): if isinstance(pmeta, str):
data = self.kwdict.copy() data = self.kwdict.copy()
if kwdict: if kwdict: