fix(platforms): include TGDB handler in tgdb_id fallback for supported platforms

get_supported_platforms() resolved tgdb_id from the MobyGames and
Hasheous platform entries only, but MobyGames platforms never carry a
tgdb_id and the Hasheous platform list has no TGDB mappings, so the
explicit key always overrode the value spread from the TGDB handler
with None. Mirror the fallback chain used during scans in
scan_handler.py by falling back to the TGDB platform entry itself.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
TowyTowy
2026-07-17 01:04:45 +02:00
parent 04ae566749
commit f225a99f89
2 changed files with 16 additions and 0 deletions

View File

@@ -23,3 +23,18 @@ def test_supported_platform_not_shadowed_by_variant():
assert arcade.name == "Arcade"
assert arcade.fs_slug == "arcade"
def test_supported_platform_keeps_tgdb_id_from_tgdb():
"""The TGDB platform ID must survive the metadata merge.
Regression for the tgdb_id fallback chain missing the TGDB handler
itself: MobyGames platforms never carry a tgdb_id and the Hasheous
platform list has no TGDB mappings, so every unmatched platform was
reported with tgdb_id=None even when TGDB knows the platform.
"""
supported = get_supported_platforms()
threedo = next(p for p in supported if p.slug == "3do")
# TGDB maps the 3DO platform to ID 25.
assert threedo.tgdb_id == 25

View File

@@ -90,6 +90,7 @@ def get_supported_platforms() -> list[PlatformSchema]:
or None,
"tgdb_id": moby_platform.get("tgdb_id")
or hasheous_platform.get("tgdb_id")
or tgdb_platform.get("tgdb_id")
or None,
"name": igdb_platform.get("name")
or ss_platform.get("name")