1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

[steamgriddb] implement suggestions

This commit is contained in:
blankie 2024-01-13 09:55:39 +11:00
parent 0c88373a21
commit 8995fd5f01
No known key found for this signature in database
GPG Key ID: CC15FC822C7F61F5
2 changed files with 8 additions and 9 deletions

View File

@ -3131,7 +3131,7 @@ Type
Default
``"all"``
Examples
* ``"png,jpg"``
* ``"png,jpeg"``
* ``["jpeg", "webp"]``
Description
Only include assets that are in the specified file types. ``all`` can be

View File

@ -56,16 +56,16 @@ class SteamgriddbExtractor(Extractor):
download_fake_png = self.config("download-fake-png", True)
for asset in self.assets():
urls = [asset["url"]]
urls = (asset["url"],)
if download_fake_png and asset.get("fake_png"):
urls.append(asset["fake_png"])
urls = (asset["url"], asset["fake_png"])
asset["count"] = len(urls)
yield Message.Directory, asset
for asset["num"], url in enumerate(urls, 1):
yield Message.Url, url, text.nameext_from_url(url, asset)
def _call(self, endpoint: str, **kwargs):
def _call(self, endpoint, **kwargs):
data = self.request(self.root + endpoint, **kwargs).json()
if not data["success"]:
raise exception.StopExtraction(data["error"])
@ -129,17 +129,16 @@ class SteamgriddbAssetsExtractor(SteamgriddbExtractor):
asset["game"] = data["game"]
yield asset
if data["total"] > limit * page:
page += 1
else:
if data["total"] <= limit * page:
break
page += 1
def config_list(self, key, type_name, valid_values):
value = self.config(key, ["all"])
value = self.config(key)
if isinstance(value, str):
value = value.split(",")
if "all" in value:
if value is None or "all" in value:
return ["all"]
for i in value: