fix igdb search

This commit is contained in:
mein Name 2024-12-09 06:56:29 +00:00 committed by Henri Dickson
parent 67206367ec
commit 1713e473ba
2 changed files with 8 additions and 2 deletions

View file

@ -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))

View file

@ -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,