SteamGridDB: request PNG only for logos and icons

The live API rejects mimes=image/jpeg on /logos and /icons, so every logo and
icon lookup fell back to generated art. Found with a real key: SuperTux now
gets grid, wide, hero and logo; Beat Saber all five.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
saphidandClaude Opus 5.5 committed 2026-09-29 08:08:08 +10:00
1 parent d18f1655be
commit 2c8e2fb2a8
2 files changed
+7 -1

No files matched your search

+4
View File
@@ -329,6 +329,10 @@ class SteamGridDB(unittest.TestCase):
self.assertEqual(set(images),set(artwork.SLOTS));self.assertEqual(warnings,[]) self.assertEqual(set(images),set(artwork.SLOTS));self.assertEqual(warnings,[])
self.assertTrue(all(url.endswith('/top.png') for url in images.values())) self.assertTrue(all(url.endswith('/top.png') for url in images.values()))
self.assertTrue(all('/game/2?' in p for p in calls[1:])) self.assertTrue(all('/game/2?' in p for p in calls[1:]))
# SteamGridDB rejects JPEG in logo/icon queries (the live API returned an error for SuperTux).
for p in calls[1:]:
jpeg = 'image%2Fjpeg' in p
self.assertEqual(jpeg, p.startswith(('/grids/', '/heroes/')), p)
def test_unicode_titles_match_exactly_and_symbols_never_match_all(self): def test_unicode_titles_match_exactly_and_symbols_never_match_all(self):
self.assertEqual(sgdb._name('ビートセイバー VR!'), 'ビートセイバーvr') self.assertEqual(sgdb._name('ビートセイバー VR!'), 'ビートセイバーvr')
+3 -1
View File
@@ -84,7 +84,9 @@ def lookup(name, deadline=None):
for slot, kind, dimensions in [('grid', 'grids', '600x900'), ('wide', 'grids', '920x430'), for slot, kind, dimensions in [('grid', 'grids', '600x900'), ('wide', 'grids', '920x430'),
('hero', 'heroes', ''), ('logo', 'logos', ''), ('icon', 'icons', '')]: ('hero', 'heroes', ''), ('logo', 'logos', ''), ('icon', 'icons', '')]:
try: try:
query = {'types': 'static', 'nsfw': 'false', 'humor': 'false', 'mimes': 'image/png,image/jpeg'} # Logos and icons only come as PNG (or WebP/ICO); asking for JPEG there is rejected outright.
mimes = 'image/png,image/jpeg' if kind in ('grids', 'heroes') else 'image/png'
query = {'types': 'static', 'nsfw': 'false', 'humor': 'false', 'mimes': mimes}
if dimensions: if dimensions:
query['dimensions'] = dimensions query['dimensions'] = dimensions
records = _get('/' + kind + '/game/' + str(gid) + '?' + urllib.parse.urlencode(query), key, deadline) records = _get('/' + kind + '/game/' + str(gid) + '?' + urllib.parse.urlencode(query), key, deadline)