Filter out products that are not installable from the extras list for GOG.

DLCs you do not own are listed by the GOG api but are _not_ installable, and we will get 404s trying to download the extras for them.

So let's not offer them at all.
This commit is contained in:
Daniel Johnson 2024-01-12 17:05:01 -05:00
parent 30b62ab94a
commit 6f283f21a4

View file

@ -332,17 +332,19 @@ class GOGService(OnlineService):
products = [game, *dlcs] if dlcs else [game]
all_extras = {}
for product in products:
extras = [
{
"name": download.get("name", "").strip().capitalize(),
"type": download.get("type", "").strip(),
"total_size": download.get("total_size", 0),
"id": str(download["id"]),
"downlinks": [f.get("downlink") for f in download.get("files") or []]
} for download in product["downloads"].get("bonus_content") or []
]
if extras:
all_extras[product.get("title", "").strip()] = extras
# Extras for DLCs you don't own are listed, but are not installable.
if product.get("is_installable"):
extras = [
{
"name": download.get("name", "").strip().capitalize(),
"type": download.get("type", "").strip(),
"total_size": download.get("total_size", 0),
"id": str(download["id"]),
"downlinks": [f.get("downlink") for f in download.get("files") or []]
} for download in product["downloads"].get("bonus_content") or []
]
if extras:
all_extras[product.get("title", "").strip()] = extras
return all_extras
def get_installers(self, downloads, runner, language="en"):