From 1713e473ba175e1e717359ce59409c6306bb7c95 Mon Sep 17 00:00:00 2001 From: mein Name Date: Mon, 9 Dec 2024 06:56:29 +0000 Subject: [PATCH] fix igdb search --- catalog/search/external.py | 2 ++ catalog/sites/igdb.py | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/catalog/search/external.py b/catalog/search/external.py index 4c3c5ece..5191322a 100644 --- a/catalog/search/external.py +++ b/catalog/search/external.py @@ -363,6 +363,8 @@ class ExternalSources: if c == "all" or c == "book": results.extend(GoogleBooks.search(q, page)) results.extend(Goodreads.search(q, page)) + if c == "all" or c == "game": + results.extend(IGDB.search(q, page)) if c == "all" or c == "music": results.extend(Spotify.search(q, page)) results.extend(Bandcamp.search(q, page)) diff --git a/catalog/sites/igdb.py b/catalog/sites/igdb.py index bd6dc6a8..f27721fd 100644 --- a/catalog/sites/igdb.py +++ b/catalog/sites/igdb.py @@ -83,7 +83,7 @@ class IGDB(AbstractSite): def search(cls, q, limit: int, offset: int = 0): rs = cls.api_query( "games", - f'fields name; search "{quote_plus(q)}"; limit {limit}; offset {offset};', + f'fields *, cover.url, genres.name, platforms.name, involved_companies.*, involved_companies.company.name; search "{quote_plus(q)}"; limit {limit}; offset {offset};', ) result = [] for r in rs: @@ -99,7 +99,11 @@ class IGDB(AbstractSite): ) brief = r["summary"] if "summary" in r else "" brief += "\n\n" + r["storyline"] if "storyline" in r else "" - cover = "https:" + r["cover"]["url"] if r.get("cover") else "" + cover = ( + "https:" + r["cover"]["url"].replace("t_thumb", "t_cover_big") + if r.get("cover") + else "" + ) result.append( ExternalSearchResultItem( ItemCategory.Game,