Commit Graph

145 Commits

Author SHA1 Message Date
Georges-Antoine Assi
b1f01ce66b fix(igdb): don't match series games to their base title
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>
2026-07-18 19:48:27 -04:00
TowyTowy
ae6e6adbe2 fix(metadata): search the whole filename for Sony serial codes
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>
2026-07-18 12:11:29 +02:00
Georges-Antoine Assi
04c95c8ad6 fix: normalize IGDB region priority matching
Generated-By: PostHog Code
Task-Id: 6764d95b-659d-4e11-a5c5-28e65431d944
2026-07-17 09:09:15 -04:00
Georges-Antoine Assi
070851d2d8 fix: respect configured IGDB region priority
Generated-By: PostHog Code
Task-Id: 6764d95b-659d-4e11-a5c5-28e65431d944
2026-07-17 08:52:11 -04:00
Georges-Antoine Assi
6bfa5c4b59 cleanup IDs 2026-06-01 17:19:57 -04:00
Spinnich
9ba4e12fa8 Match IGDB regional-twin platforms in scans (#3462)
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>
2026-06-01 13:40:42 +00:00
Spinnich
7e08a43e12 fix(igdb): match ROMs by localized/alternative titles in scan
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>
2026-05-31 02:31:46 +00:00
Georges-Antoine Assi
1377e2991d fix test again 2026-05-21 18:30:30 -04:00
Georges-Antoine Assi
f9c0a8f966 run fmt 2026-05-21 18:09:01 -04:00
copilot-swe-agent[bot]
3ea960d008 fix: IGDB/SGDB scraping incorrectly matches standalone expansions to parent game
- 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>
2026-05-21 11:30:23 +00:00
Georges-Antoine Assi
dad1250e15 case-insensitive region lookup for provider shortcode mapping
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>
2026-05-13 09:34:10 -04:00
Georges-Antoine Assi
944514acc0 prefer rom's own region tag for ScreenScraper and IGDB artwork
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>
2026-05-13 09:06:11 -04:00
Georges-Antoine Assi
58e16d9c69 [ROMM-2949] Add support for shortfile scummvm names 2026-01-29 11:12:35 -05:00
Georges-Antoine Assi
bddb7bd9f5 manual cleanup 2026-01-18 22:27:46 -05:00
Georges-Antoine Assi
70522ee6fd set generation for a couple consoles 2026-01-18 09:36:12 -05:00
Georges-Antoine Assi
a0d5307cf3 mark tg16cd as console 2026-01-11 16:49:48 -05:00
Georges-Antoine Assi
09aa6628f8 Merge pull request #2872 from DevOldSchool/feature/player-count
feat: Added player count metadata from SS with display and filter
2026-01-10 22:59:08 -05:00
DevOldSchool
4a9a326ab6 Updates from code review feedback. 2026-01-11 13:41:24 +10:00
DevOldSchool
43f5e9f6f5 Added IGDB player count support. 2026-01-07 12:59:22 +10:00
Georges-Antoine Assi
1610bf29de [HOTFIX] Set metadata fields as nullable 2026-01-03 17:42:18 -05:00
Georges-Antoine Assi
4465784a05 [ROMM-2833] Fix using default locales in igdb handler 2026-01-02 12:26:48 -05:00
Georges-Antoine Assi
9dfad6cb87 run trunk fmt 2025-11-26 11:15:44 -05:00
Tanguy Mazé
28823d39dd Refactor to use scan.priority.region for IGDB localization
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>
2025-11-23 02:01:13 +01:00
Tanguy Mazé
addc1a2118 Add metadata locale selection for IGDB and ScreenScraper
- 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>
2025-11-23 00:01:12 +01:00
Georges-Antoine Assi
38f42aa352 Merge branch 'master' into romm-2536 2025-10-23 18:24:36 -04:00
Georges-Antoine Assi
fd86fc456e add note in scammvm map 2025-10-19 21:20:42 -04:00
Georges-Antoine Assi
06724c7a6f [ROMM-2424] Add special case for scummvm games in igdb handler 2025-10-19 21:11:48 -04:00
Georges-Antoine Assi
81702a4bbd Add endpoint for ps3 pkgi 2025-10-19 11:16:32 -04:00
Georges-Antoine Assi
e4b7692fcd display paltform category and family 2025-10-19 09:35:50 -04:00
Georges-Antoine Assi
e20814a298 [ROMM-2546] Suborder consoles by generation 2025-10-19 09:08:48 -04:00
Georges-Antoine Assi
877145b339 consistent family names 2025-10-17 22:22:10 -04:00
Georges-Antoine Assi
df68dc9bd9 Merge both odyssey 2 platform 2025-10-03 16:28:02 -04:00
Georges-Antoine Assi
da10fffae3 change title of series xs platform 2025-10-03 16:25:59 -04:00
Georges-Antoine Assi
7a5185fe22 complete rest of handler 2025-09-20 19:38:26 -04:00
Georges-Antoine Assi
8c33a95637 remove hartbeat from bh endpoint 2025-09-20 17:57:38 -04:00
Georges-Antoine Assi
e9f7da09f9 add metadata status page and heartbeats 2025-09-20 09:19:15 -04:00
Georges-Antoine Assi
3c4113f8a8 Merge branch 'master' into flashpoint-metadata-handler 2025-09-11 21:27:48 -04:00
Georges-Antoine Assi
d7e85ba633 [ROMM-1333] Use metadata tag in filename to match game 2025-09-07 14:12:30 -04:00
Michael Manganiello
e4e3928d1b misc: Apply import sorting 2025-09-04 11:17:00 -03:00
Michael Manganiello
d216bad78b misc: Add MetadataHandler's is_enabled method
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.
2025-09-03 22:13:28 -03:00
Michael Manganiello
b2ea84b5bb misc: Create IGDB service adapter
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.
2025-08-30 20:21:15 -03:00
Georges-Antoine Assi
ef2546ec08 fix base handler filename 2025-08-27 12:40:16 -04:00
Georges-Antoine Assi
ee0110699d fix id column type 2025-08-27 11:23:27 -04:00
Georges-Antoine Assi
d41a920c37 normalize split tiles for ssfr 2025-08-17 20:29:44 -04:00
Georges-Antoine Assi
f0574577c9 Prefer lower IDs when matching games with same title 2025-08-17 19:53:29 -04:00
Georges-Antoine Assi
659a3eb104 use jaro-winkler algo 2025-08-08 16:54:26 -04:00
Georges-Antoine Assi
1a2944806b Use best-match algo for more providers 2025-08-07 16:57:29 -04:00
Georges-Antoine Assi
90f10e8946 Fixed platform slugs that were missed 2025-08-06 17:28:10 -04:00
Georges-Antoine Assi
8ce943a514 use fastapi status 2025-08-02 22:17:07 -04:00
Georges-Antoine Assi
c2c80fbfc3 fix tests 2025-07-24 17:33:14 -04:00