Skip to content

Unify platform slugs #2143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Aug 2, 2025
Merged

Unify platform slugs #2143

merged 19 commits into from
Aug 2, 2025

Conversation

gantoine
Copy link
Member

@gantoine gantoine commented Jul 24, 2025

This PR can be merged after v4.1 is released

Description
Explain the changes or enhancements you are proposing with this pull request.

This monster of a PR organizes and centralizes all the platform slugs known to the various metadata handlers. By centralizing them all we can nearly guarantee we don't miss any slugs, mismatch the slugs with IDs, typo the keys or let extra invalid/duplicate slugs slip in.

I've also taken the opportunity to rename some of the slugs that were poorly named or confusing, and removing duplicate slugs. Migration 0046 handles updating both the slug value in the platform model and updating the user's config.yml file with the right platform mapping.

Note that mounting a config.yml file is now required in case we need to update it, and the app will fail to start if one isn't present.

"cpc": acpc
"apple-i": apple
"apple2": appleii
"apple2gs": apple-iigs
"apple3": appleiii
"mattel-aquarius": aquarius
"atari-2600": atari2600
"atari-5200": atari5200
"atari-7800": atari7800
"atari-8-bit": atari8bit
"bally-astrocade": astrocade
"bbc-micro": bbcmicro
"cd-i": philips-cd-i
"cdtv": commodore-cdtv
"channel-f": fairchild-channel-f
"commodore-16-plus4": c-plus-4
"dragon-3264": dragon-32-slash-64
"dreamcast": dc
"edsac--1": edsac
"electron": acorn-electron
"elektor-tv-games-computer": elektor
"fmtowns": fm-towns
"game-com": game-dot-com
"gameboy": gb
"gameboy-color": gbc
"gameboy-advance": gba
"game-gear": gamegear
"gamecube": ngc
"genesis-slash-megadrive": genesis
"macintosh": mac
"microcomputer--1": microcomputer
"microvision--1": microvision
"neo-geo": neogeoaes
"odyssey--1": odyssey
"nintendo-ds": nds
"palmos": palm-os
"pc88": pc-8800-series
"pc98": pc-9800-series
"pet": cpet
"pdp-7--1": pdp-7
"pdp-8--1": pdp-8
"playstation": psx
"ps": psx
"ps4--1": ps4
"playstation-4": ps4
"playstation-5": ps5
"ps-vita": psvita
"sega-32x": sega32
"sega-cd": segacd
"sega-master-system": sms
"sega-saturn": saturn
"sharp-x1": x1
"sinclair-zx81": zx81
"sg-1000": sg1000
"switch2": switch-2
"thomson-mo": thomson-mo5
"trs-80-coco": trs-80-color-computer
"turbografx-16-slash-pc-engine-cd": turbografx-cd
"turbo-grafx": tg16
"turbografx16--1": tg16
"watara-slash-quickshot-supervision": supervision
"windows": win,

Checklist
Please check all that apply.

  • I've tested the changes locally
  • I've updated relevant comments
  • I've assigned reviewers for this PR
  • I've added unit tests that cover the changes

Copy link

trunk-io bot commented Jul 24, 2025

Running Code Quality on PRs by uploading data to Trunk will soon be removed. You can still run checks on your PRs using trunk-action - see the migration guide for more information.

Copy link

github-actions bot commented Jul 24, 2025

Test Results

546 tests   545 ✅  55s ⏱️
  1 suites    1 💤
  1 files      0 ❌

Results for commit 4e2bde2.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 24, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
8556 6095 71% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
backend/adapters/services/rahasher.py 100% 🟢
backend/config/config_manager.py 46% 🟢
backend/endpoints/platform.py 43% 🟢
backend/endpoints/responses/feeds.py 100% 🟢
backend/endpoints/responses/platform.py 100% 🟢
backend/endpoints/search.py 30% 🟢
backend/handler/database/roms_handler.py 51% 🟢
backend/handler/filesystem/roms_handler.py 70% 🟢
backend/handler/metadata/base_hander.py 99% 🟢
backend/handler/metadata/hasheous_handler.py 42% 🟢
backend/handler/metadata/igdb_handler.py 69% 🟢
backend/handler/metadata/launchbox_handler.py 41% 🟢
backend/handler/metadata/moby_handler.py 40% 🟢
backend/handler/metadata/ra_handler.py 54% 🟢
backend/handler/metadata/ss_handler.py 31% 🟢
backend/handler/metadata/tgdb_handler.py 100% 🟢
backend/handler/scan_handler.py 65% 🟢
backend/models/platform.py 97% 🟢
TOTAL 65% 🟢

updated for commit: 4e2bde2 by action🐍

Copy link
Contributor

@Copilot 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

This PR unifies platform slugs across the application by introducing a centralized UniversalPlatformSlug enum and updating platform mappings to use consistent naming conventions. The changes standardize platform identifiers throughout the system, making them more maintainable and reducing inconsistencies.

  • Introduces UniversalPlatformSlug enum to standardize platform identifiers across all metadata handlers
  • Updates platform mappings in all metadata handlers to use the centralized enum
  • Simplifies platform slug naming by removing verbose descriptors (e.g., "genesis-slash-megadrive" → "genesis")

Reviewed Changes

Copilot reviewed 27 out of 62 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
frontend/src/utils/index.ts Updates EJS cores and control schemes mappings to use simplified platform slugs
frontend/src/components/Gallery/AppBar/Platform/PlatformInfoDrawer.vue Changes IGDB URL to use igdb_slug instead of generic slug
frontend/package.json Updates OpenAPI generation endpoint port from 5000 to 3000
frontend/assets/platforms/ATTRIBUTIONS Renames platform asset file references to match new slug format
examples/config.es-de.example.yml Updates ES-DE configuration with new unified platform mappings
examples/config.batocera-retrobat.yml Updates Batocera/RetroBat configuration with new platform mappings
backend/utils/generate_supported_platforms.py Refactors to use UniversalPlatformSlug enum instead of hardcoded mappings
backend/models/platform.py Adds igdb_slug and moby_slug properties, removes logo_path field
backend/models/fixtures/known_bios_files.json Updates BIOS file mappings to use new platform slugs
backend/handler/scan_handler.py Updates metadata source checks to use platform lists for validation
backend/handler/metadata/tests/test_base_handler.py Adds comprehensive test coverage for the new base handler functionality
backend/handler/metadata/ss_handler.py Updates Screenscraper handler to use UniversalPlatformSlug enum
backend/handler/metadata/ra_handler.py Updates RetroAchievements handler to use UniversalPlatformSlug enum
backend/handler/metadata/moby_handler.py Updates MobyGames handler to use UniversalPlatformSlug enum
Files not reviewed (1)
  • frontend/src/generated/models/PlatformSchema.ts: Language not supported

@gantoine gantoine marked this pull request as ready for review July 25, 2025 03:56
@gantoine gantoine merged commit 1d73c0a into master Aug 2, 2025
10 checks passed
@gantoine gantoine deleted the universal-slugs branch August 2, 2025 02:21
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.

1 participant