diff --git a/tests/test_library_entrypoints.py b/tests/test_library_entrypoints.py index 1ee80ff..2888249 100644 --- a/tests/test_library_entrypoints.py +++ b/tests/test_library_entrypoints.py @@ -329,6 +329,10 @@ class SteamGridDB(unittest.TestCase): 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('/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): self.assertEqual(sgdb._name('ビートセイバー VR!'), 'ビートセイバーvr') diff --git a/ui/frame_steamgriddb.py b/ui/frame_steamgriddb.py index 017511c..6a18bba 100644 --- a/ui/frame_steamgriddb.py +++ b/ui/frame_steamgriddb.py @@ -84,7 +84,9 @@ def lookup(name, deadline=None): for slot, kind, dimensions in [('grid', 'grids', '600x900'), ('wide', 'grids', '920x430'), ('hero', 'heroes', ''), ('logo', 'logos', ''), ('icon', 'icons', '')]: 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: query['dimensions'] = dimensions records = _get('/' + kind + '/game/' + str(gid) + '?' + urllib.parse.urlencode(query), key, deadline)