Prefer ROM's own region tag for ScreenScraper and IGDB artwork#3367
Conversation
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>
Test Results (mariadb) 1 files 1 suites 4m 21s ⏱️ Results for commit 8e009df. ♻️ This comment has been updated with latest results. |
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
Test Results (postgresql) 1 files 1 suites 4m 8s ⏱️ Results for commit 8e009df. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Pull request overview
Updates metadata selection so ScreenScraper and IGDB prefer a ROM’s own parsed filename region tags (e.g. (Europe)) before falling back to scan.priority.region, preventing config-first region priority from forcing mismatched artwork/localized titles.
Changes:
- Add
REGION_NAME_TO_PROVIDER_SHORTCODEmapping and use it to translate ROM region names into provider region codes. - Update ScreenScraper region preference logic to prepend ROM-tag-derived regions.
- Thread
Romthrough IGDB handler lookup methods so IGDB locale/artwork selection can prefer ROM-tag regions.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/tests/handler/metadata/test_ss_handler.py | Adjusts test ROM factory to support rom.regions. |
| backend/handler/scan_handler.py | Updates IGDB scan calls to pass rom into the IGDB handler. |
| backend/handler/metadata/ss_handler.py | Prepends ROM-tag-derived regions to ScreenScraper region preference order. |
| backend/handler/metadata/igdb_handler.py | Prefers ROM-tag-derived region when choosing IGDB localization/cover. |
| backend/handler/filesystem/base_handler.py | Introduces shared region-name → provider-shortcode mapping. |
| backend/endpoints/search.py | Passes rom into IGDB search/match methods. |
| backend/endpoints/roms/init.py | Passes rom into IGDB lookup when updating a ROM’s IGDB metadata. |
Comments suppressed due to low confidence (1)
backend/handler/metadata/ss_handler.py:45
REGION_NAME_TO_PROVIDER_SHORTCODElookup is case-sensitive, butRom.regionscomes from filename tag parsing (FSRomsHandler.parse_tags) which preserves the raw tag text. If a ROM tag is(europe)/ mixed-case, the mapping will miss and the ROM’s region won’t actually be preferred. Normalizeregion_name(e.g.,casefold()/title()) or change the mapping to use lowercase keys and look up withcasefold().
if rom is not None and isinstance(rom.regions, list):
for region_name in rom.regions:
code = REGION_NAME_TO_PROVIDER_SHORTCODE.get(region_name)
if code:
rom_codes.append(code)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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>
…setting Covers now use object-fit: contain inside a fixed slot, so each image keeps its own aspect ratio (letterboxed where needed) instead of being cropped to the platform's configured ratio. The slot itself still uses a single default aspect ratio for grid stability, so cards don't reflow as images load. With per-platform aspect ratio no longer doing anything visible, remove the Cover style picker from the platform info drawer and clean up dead plumbing: galleryViewStore.getAspectRatio no longer reads platform.aspect_ratio, platformId is dropped from Skeleton / SearchCover / MatchRom / showSearchCoverDialog, and the orphaned i18n keys (cover-style, settings, old-squared-cases, old-horizontal-cases) are stripped from all platform.json locale files. Backend aspect_ratio column is left in place; no client sends it anymore. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
(Europe)) before falling back toscan.priority.regionwhen picking artwork and localized titles. Previously, a US-first config would force US covers onto European ROMs even when an EU asset existed.REGION_NAME_TO_PROVIDER_SHORTCODEmap ("Europe"→"eu", etc.) so the ROM's parsed region names line up with what providers expect.Romthrough IGDB'sget_rom,get_rom_by_id,get_matched_rom_by_id, andget_matched_roms_by_nameso they can consult its regions; signatures now match the ScreenScraper handler (rom first, required).Test plan
Game (Europe).rom,Game (Japan).rom) and confirm SS pulls EU/JP covers per the tag while config priority still governs untagged ROMsScreenshots