fix igdb search
This commit is contained in:
parent
67206367ec
commit
1713e473ba
2 changed files with 8 additions and 2 deletions
|
@ -363,6 +363,8 @@ class ExternalSources:
|
||||||
if c == "all" or c == "book":
|
if c == "all" or c == "book":
|
||||||
results.extend(GoogleBooks.search(q, page))
|
results.extend(GoogleBooks.search(q, page))
|
||||||
results.extend(Goodreads.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":
|
if c == "all" or c == "music":
|
||||||
results.extend(Spotify.search(q, page))
|
results.extend(Spotify.search(q, page))
|
||||||
results.extend(Bandcamp.search(q, page))
|
results.extend(Bandcamp.search(q, page))
|
||||||
|
|
|
@ -83,7 +83,7 @@ class IGDB(AbstractSite):
|
||||||
def search(cls, q, limit: int, offset: int = 0):
|
def search(cls, q, limit: int, offset: int = 0):
|
||||||
rs = cls.api_query(
|
rs = cls.api_query(
|
||||||
"games",
|
"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 = []
|
result = []
|
||||||
for r in rs:
|
for r in rs:
|
||||||
|
@ -99,7 +99,11 @@ class IGDB(AbstractSite):
|
||||||
)
|
)
|
||||||
brief = r["summary"] if "summary" in r else ""
|
brief = r["summary"] if "summary" in r else ""
|
||||||
brief += "\n\n" + r["storyline"] if "storyline" 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(
|
result.append(
|
||||||
ExternalSearchResultItem(
|
ExternalSearchResultItem(
|
||||||
ItemCategory.Game,
|
ItemCategory.Game,
|
||||||
|
|
Loading…
Add table
Reference in a new issue