Match IGDB regional-twin platforms in scans (#3462)#3463
Open
Spinnich wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
IGDB catalogues a console and its regional twin as two separate platforms — e.g. SNES (
19) vs. Super Famicom (58), and NES (18) vs. Famicom (99). A region-exclusive title is filed under only one of the pair, so a scan that locks the IGDBwhereclause to a single platform id silently misses those titles: a Japan-only Super Famicom game never matches from ansneslibrary, and a Western-only SNES game never matches fromsfam. Same for NES/Famicom.This maps each regional-twin platform to its counterpart and broadens the IGDB platform filter to include both, so region-exclusive games on either twin match from either library. Fixes #3462.
The change is confined to the IGDB metadata handler's query construction — matching logic, scan orchestration, and every other provider are untouched. Behaviour for all non-twin platforms is byte-for-byte identical (the filter keeps the original
platforms=[id]shape).What changed
IGDB_REGIONAL_TWIN_PLATFORMSmap (SNES↔Super Famicom, NES↔Famicom), backed by namedFinalplatform-id constants.igdb_handler.py:_platform_igdb_ids_with_twin(id)→[id], or[id, twin]when a twin exists._build_platforms_where(id, field="platforms")→ a singleplatforms=[id]clause for non-twin platforms, or a parenthesized(platforms=[a] | platforms=[b])OR-group for twins, so it composes correctly with trailing& …filters.platforms=[…]/game.platforms=[…]filter in_search_romandget_matched_roms_by_namethrough the helper. The ScummVMkeywords=[…]special case is intentionally left as-is (it has no twin).Files modified
backend/handler/metadata/igdb_handler.py— new twin map + the two helpers; the four platformwherefragments now build through_build_platforms_where.backend/tests/handler/metadata/test_igdb_handler.py— addedTestRegionalTwinPlatformHelpers(unit tests: bidirectional pairs, non-twin passthrough, single-clause vs. OR-group output) andTestSearchRomRegionalTwinPlatforms(search picks up a Super-Famicom-only game from ansnesscan, a Famicom-only game fromnes, an SNES-only game fromsfam, and a non-twin platform keeps a single-clause filter with no OR group).Reviewer notes
(platforms=[a] | platforms=[b])(OR of two exact clauses) rather than IGDB'splatforms=(a,b)contains-any form, to preserve the exact per-clause semantics the existing single-platform queries rely on.derive_player_countfilters multiplayer modes by the originalplatform_igdb_id, so a game matched via its twin may drop twin-tagged multiplayer modes when deriving player count. Low impact; flagging for awareness.Checklist
Screenshots (if applicable)
N/A — backend metadata-matching change, no UI surface.