Skip to content

Prefer ROM's own region tag for ScreenScraper and IGDB artwork#3367

Merged
gantoine merged 3 commits into
masterfrom
regional-provider-tags
May 13, 2026
Merged

Prefer ROM's own region tag for ScreenScraper and IGDB artwork#3367
gantoine merged 3 commits into
masterfrom
regional-provider-tags

Conversation

@gantoine
Copy link
Copy Markdown
Member

@gantoine gantoine commented May 13, 2026

Summary

  • ScreenScraper and IGDB now check the ROM's filename region tag (e.g. (Europe)) before falling back to scan.priority.region when picking artwork and localized titles. Previously, a US-first config would force US covers onto European ROMs even when an EU asset existed.
  • Adds a shared REGION_NAME_TO_PROVIDER_SHORTCODE map ("Europe""eu", etc.) so the ROM's parsed region names line up with what providers expect.
  • Threads the Rom through IGDB's get_rom, get_rom_by_id, get_matched_rom_by_id, and get_matched_roms_by_name so they can consult its regions; signatures now match the ScreenScraper handler (rom first, required).

Test plan

  • Scan a library with mixed region tags (e.g. Game (Europe).rom, Game (Japan).rom) and confirm SS pulls EU/JP covers per the tag while config priority still governs untagged ROMs

Screenshots

Screenshot 2026-05-13 at 9 30 45 AM Screenshot 2026-05-13 at 9 30 48 AM

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>
Copilot AI review requested due to automatic review settings May 13, 2026 13:09
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

Test Results (mariadb)

    1 files      1 suites   4m 21s ⏱️
1 320 tests 1 320 ✅ 0 💤 0 ❌
1 322 runs  1 322 ✅ 0 💤 0 ❌

Results for commit 8e009df.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
16317 11331 69% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
backend/endpoints/roms/_init_.py 63% 🟢
backend/endpoints/search.py 29% 🟢
backend/handler/filesystem/base_handler.py 90% 🟢
backend/handler/metadata/igdb_handler.py 36% 🟢
backend/handler/metadata/ss_handler.py 39% 🟢
backend/handler/scan_handler.py 56% 🟢
TOTAL 52% 🟢

updated for commit: 8e009df by action🐍

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

Test Results (postgresql)

    1 files      1 suites   4m 8s ⏱️
1 320 tests 1 320 ✅ 0 💤 0 ❌
1 322 runs  1 322 ✅ 0 💤 0 ❌

Results for commit 8e009df.

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_SHORTCODE mapping and use it to translate ROM region names into provider region codes.
  • Update ScreenScraper region preference logic to prepend ROM-tag-derived regions.
  • Thread Rom through 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_SHORTCODE lookup is case-sensitive, but Rom.regions comes 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. Normalize region_name (e.g., casefold()/title()) or change the mapping to use lowercase keys and look up with casefold().
    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.

Comment thread backend/handler/metadata/ss_handler.py
Comment thread backend/handler/metadata/igdb_handler.py Outdated
Comment thread backend/handler/filesystem/base_handler.py
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>
@gantoine gantoine merged commit c6a2f56 into master May 13, 2026
14 checks passed
@gantoine gantoine deleted the regional-provider-tags branch May 13, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants