Series titles like "Metal Gear Solid: Portable Ops Plus" and the Pokemon
Ranger games were resolved to the same IGDB (and, downstream, SteamGridDB)
entry as their base game, so distinct ROMs became siblings.
The first `_search_rom` pass filters by game_type, which excludes types like
EXPANSION, so a more specific variant is often absent from its candidates.
Jaro-Winkler scores the base title against the searched variant at ~0.99
(well above the 0.75 threshold), so the base was accepted and returned before
the broader search passes ran.
Only trust a first-pass hit outright when it is an exact match or not a
prefix/superset near-miss of the search term. Otherwise widen the search:
re-query without the game_type filter (the reliable recovery for excluded
types) alongside the existing expanded search, then re-rank across the union
so an exact variant outranks the base near-miss. The base stays in the pool,
so it remains the fallback when no better match exists.
Fixes#3805
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pattern.search() takes pos as its second argument, not flags, so passing
re.IGNORECASE (value 2) started the serial scan at index 2. Filenames
that begin with the serial itself (e.g. SCUS-94163.bin) never matched,
and the PS1/PS2/PSP serial index resolution was silently skipped in the
IGDB, MobyGames, and ScreenScraper handlers.
The regex already matches both cases via [a-zA-Z], and the serial is
uppercased before the Redis lookup (#3621), so the intended flag added
nothing. Drop the stray argument so serials are found anywhere in the
filename, including at the start.
Co-Authored-By: Claude <noreply@anthropic.com>
IGDB catalogues a console and its regional twin as two separate
platforms (SNES/Super Famicom, NES/Famicom). RomM locked each IGDB
search to a single platform id, so a region-exclusive title catalogued
under only the twin — e.g. the Japan-only Super Famicom game
"Rudra no Hihou" (platform 58) scanned from an `snes` folder
(platform 19) — was filtered out before name matching ran and never
matched.
Include a platform's regional twin in the IGDB platform filter so both
are searched. A non-twin platform keeps the exact existing query
(`platforms=[19]`); a twin produces an OR group
(`(platforms=[19] | platforms=[58])`), leaving all other platforms and
recorded cassettes unchanged.
Written primarily by Claude Code.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
IGDB scans dropped games whose filename uses a localized (non-English)
title even when that title exists in IGDB's alternative_names. The
alternative_name wildcard search surfaced the correct game, but
_search_rom() rebuilt its name->game candidate dict using only the
primary English name, so the Jaro-Winkler re-check scored the localized
term below threshold and discarded the match (issue #3435).
Add _index_games_by_searchable_name(), which indexes each game by its
primary name plus alternative_names and game_localizations titles, and
use it for both candidate-building passes in _search_rom(). Primary
names keep precedence (lowest-igdb-id tiebreak); alternative/
localization titles fill in only names not already claimed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Add `STANDALONE_EXPANSION` game type to the `with_game_type` filter in
`_search_rom` so games like "Ecco: The Tides of Time" (which IGDB classifies
as a standalone expansion) are included in the first search pass and are not
confused with their parent game ("Ecco The Dolphin")
- Fix the expanded search fallback to fetch and compare ALL unique game IDs
returned by the IGDB search endpoint, instead of only the first result
- Add tests to verify both fixes
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/d6a0c1dd-e541-4d8e-a272-9e5511a2077e
Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
Rom.regions can contain raw filename text like "europe" or "EUROPE"
(filename parsing in roms_handler doesn't normalize casing), so the
direct dict lookup missed those tags and the locale silently fell back
to scan.priority.region. Replace the dict access with a helper that
lowercases both sides.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When a ROM filename carries a region tag (e.g. (Europe)), use that
region first when picking artwork and localized titles, falling back to
the configured scan.priority.region. Previously the configured priority
was the only signal, so a US-first config would force US covers onto
European ROMs even when an EU asset was available.
Adds a shared name->provider-shortcode map and threads the rom through
the IGDB and SS lookup APIs so the rom-aware locale/region selection
can run for both providers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Remove provider-specific locale configuration and use existing scan.priority.region for IGDB regional variants.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add provider-specific locale config with UI dropdowns in Settings
- ScreenScraper: select language for synopsis/metadata
- IGDB: select region for localized names/covers
- Fallback warnings when locale not found
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <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 IGDB 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.
The API authorization was also improved to not rely on decorating each
method that makes requests, but instead using an `aiohttp` middleware
to automatically add the required headers to each request.
Utils `mark_expanded` and `mark_list_expanded` where added to help
narrow the types of IGDB's expandable fields when we know they are
expanded, for `mypy` type checking.