Every gathered provider already resolved through a single loop that logs the
failure, drops the source from the attempted set and falls back to an empty
match. SteamGridDB, which searches on the names the other providers produce and
so cannot join that gather, hand-wrote the same three steps again, and the
search endpoint hand-wrote a third copy. Extract the loop body into
`resolve_fetch` and route SteamGridDB through it.
In the search endpoint the cover gathers now tolerate exceptions instead, so a
failed lookup costs a thumbnail rather than the whole result set. That also
covers Libretro, whose lookup had no guard at all and could fail the request.
On the test side, the platform, rom and `fs_rom` scaffolding was written out
three times across the two scan tests; it now lives in `tests/handler/scan_stubs.py`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A complete rescan clears the id of every source it consulted that came back
empty. That reads an outage as a conclusive miss for the providers that report
a failure as an empty match, so a rescan run while one was down wiped the id it
would otherwise have confirmed, hand-set ones included.
Each of those now reports the failure and leaves the tolerance to the caller,
which is what the gather loop's discard already assumed:
- Pouët, CSDb and Demozoo stop swallowing the 503 their own `_request` raises,
and Pouët's title search raises it rather than answering "no unique title".
- SteamGridDB and Flashpoint stop catching `Exception` around a whole lookup;
HLTB stops catching it around its search.
- ScreenScraper answers empty for every remaining ROM once its daily-quota or
credentials breaker trips, so the scan reads that state off the service and
drops it from the sources the rescan may clear.
SteamGridDB resolves outside the gather and so needs the discard at its call
site. Search keeps degrading to no thumbnail, since its cover art sits on top
of matches the other providers already produced.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
SteamGridDB does not remove assets taken down under DMCA; it returns them
with "lock": true and strips the URL signature, so the CDN serves a
placeholder image reading "This asset has been removed in response to a
DMCA takedown notice" for both the full asset and its thumbnail.
Filter locked grids in _get_game_covers, the single funnel for scan
matching, ID lookups and the manual cover picker.
Closes#4003
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Move the SearchCoverDialog filtering/sorting logic into a
useCoverFilters composable. Drop the "All sources" dropdown (and its
locale key), turn the sort control into a left-floated toggle with a
Relevance/Most votes label, rename the providers-covers key to
metadata-providers, and stop resetting filters on every re-search.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds client-side filters to the v2 manual cover-search dialog so users
can narrow SteamGridDB results without endless scrolling:
- Source (SteamGridDB / each metadata provider)
- Resolution (dynamically built from the results present)
- Style (alternate / blurred / material / no logo / white logo)
- Uploader (searchable list of contributors)
- Content toggles (NSFW / humor / epilepsy, NSFW off by default)
- Sort by relevance or most votes
Backend surfaces the rich per-cover metadata SGDB already returned but
was discarding: SGDBResource / SearchCoverSchema now carry width,
height, style, author, score and content flags, and the cover-search
path fetches every content variant so the picker can toggle them
client-side. Auto-scan cover selection is unchanged and stays
safe-by-default.
New keys translated across all 18 locales.
Closes#3749
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
HasheousHandler.lookup_rom and SGDBBaseHandler.get_details_by_names now
resolve to an empty match instead of raising, matching the best-effort
pattern already used by PlaymatchHandler.lookup_rom and
SGDBBaseHandler.get_rom_by_id, so one failing provider can't abort a
scan or discard the other providers' results (#2236).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Convert `MetadataHandler` to an abstract base class and add an
`is_enabled` class method that allows every metadata handler to
independently report whether it is enabled based on its configuration.
This avoids the need for global variables in the config module, allowing
us to change the enabled state of a metadata handler at runtime if
needed.
Add a new service adapter for the SteamGridDB API, to separate
concerns with RomM's handler for metadata.
This adapter is agnostic to the handler and only provides methods to
interact with the API, and correctly return typed responses.
This change avoids blocking requests when retrieving covers from
SteamGridDB, which is the main bottleneck as the current implementation
iterates over paginated results for multiple games.
Using an asynchronous client like `httpx` provides a good performance
improvement, and reduces the latency when calling this endpoint.
Also, the inclusion of FastAPI `lifespan` allows instantiating a single
client on startup.
When testing with "Final Fantasy V Advance", the endpoint goes from ~9s
to ~1.5s to retrieve all covers.
The SteamGridDB API has a bug, where the `total` field for the paginated
endpoint `/v2/grids/game/:gameId` sometimes double/triple counts results
(e.g. returning `total=172` when there are actually 86 results).
To avoid this issue, this change relies on each page's number of
results. If the received page has less than the requested amount of
grids, we know that is the last page.