fix: don't fall back to screenshots as capsule art
All checks were successful
Build plugin / build (push) Successful in 1m10s

_best_portrait_url was falling back to non-GIF screenshots when both
coverUrl and stillCoverUrl were GIFs. Screenshots are not capsule art,
so this produced wrong imagery. Now the function only returns cover
URLs and returns empty when only GIFs are available.
This commit is contained in:
Jose Falanga 2026-08-19 18:49:29 -03:00
parent 658e8552cb
commit 98053e6ea7
2 changed files with 6 additions and 14 deletions

View file

@ -186,25 +186,17 @@ func _url_for_layout(kind: LAYOUT, cover_url: String, screenshots: Array) -> Str
return "" return ""
## Returns a non-GIF URL suitable for portrait/logo from the game data. ## Returns the best portrait/logo URL from the game data.
## Falls back through: stillCoverUrl → coverUrl (non-GIF) → first non-GIF ## Prefers stillCoverUrl, then coverUrl. Screenshots are never used as
## screenshot. Returns empty if only GIFs are available, since ## capsule art. Returns empty if the only available cover URLs are GIFs,
## HTTPImageFetcher cannot decode GIF images. ## since HTTPImageFetcher cannot decode GIF images.
func _best_portrait_url(game: Dictionary, screenshots: Array) -> String: func _best_portrait_url(game: Dictionary, _screenshots: Array) -> String:
# Prefer stillCoverUrl if it's not a GIF
var still: String = game.get("stillCoverUrl", "") var still: String = game.get("stillCoverUrl", "")
if not still.is_empty() and not _is_gif_url(still): if not still.is_empty() and not _is_gif_url(still):
return still return still
# Try coverUrl if it's not a GIF
var cover: String = game.get("coverUrl", "") var cover: String = game.get("coverUrl", "")
if not cover.is_empty() and not _is_gif_url(cover): if not cover.is_empty() and not _is_gif_url(cover):
return cover return cover
# Try the first non-GIF screenshot
for url in screenshots:
if not _is_gif_url(url):
return url
# All available URLs are GIFs — return empty so the caller gets null
# instead of attempting a doomed fetch.
return "" return ""

View file

@ -1,7 +1,7 @@
{ {
"plugin.id": "itch-artprovider", "plugin.id": "itch-artprovider",
"plugin.name": "itch.io Art Provider", "plugin.name": "itch.io Art Provider",
"plugin.version": "0.1.9", "plugin.version": "0.1.10",
"plugin.min-api-version": "1.1.0", "plugin.min-api-version": "1.1.0",
"plugin.link": "https://forge.thergic.ar/jose/itchio-opengamepadui-artprovider-plugin", "plugin.link": "https://forge.thergic.ar/jose/itchio-opengamepadui-artprovider-plugin",
"plugin.source": "https://forge.thergic.ar/jose/itchio-opengamepadui-artprovider-plugin", "plugin.source": "https://forge.thergic.ar/jose/itchio-opengamepadui-artprovider-plugin",