diff --git a/backend/endpoints/responses/feeds.py b/backend/endpoints/responses/feeds.py index 9f83b2a7b..f8fa53724 100644 --- a/backend/endpoints/responses/feeds.py +++ b/backend/endpoints/responses/feeds.py @@ -1,60 +1,62 @@ from typing import NotRequired, TypedDict +from handler.metadata.base_hander import UniversalPlatformSlug as UPS + WEBRCADE_SUPPORTED_PLATFORM_SLUGS = frozenset( ( - "3do", - "arcade", - "atari2600", - "atari5200", - "atari7800", - "c64", - "colecovision", - "dos", - "gamegear", - "gb", - "gba", - "gbc", - "genesis", - "lynx", - "n64", - "neo-geo-cd", - "neo-geo-pocket", - "neo-geo-pocket-color", - "neogeoaes", - "neogeomvs", - "nes", - "pc-fx", - "psx", - "segacd", - "sg1000", - "sms", - "snes", - "supergrafx", - "turbografx-cd", - "tg16", - "virtualboy", - "wonderswan", - "wonderswan-color", + UPS._3DO, + UPS.ARCADE, + UPS.ATARI2600, + UPS.ATARI5200, + UPS.ATARI7800, + UPS.C64, + UPS.COLECOVISION, + UPS.DOS, + UPS.GAMEGEAR, + UPS.GB, + UPS.GBA, + UPS.GBC, + UPS.GENESIS, + UPS.LYNX, + UPS.N64, + UPS.NEO_GEO_CD, + UPS.NEO_GEO_POCKET, + UPS.NEO_GEO_POCKET_COLOR, + UPS.NEOGEOAES, + UPS.NEOGEOMVS, + UPS.NES, + UPS.PC_FX, + UPS.PSX, + UPS.SEGACD, + UPS.SG1000, + UPS.SMS, + UPS.SNES, + UPS.SUPERGRAFX, + UPS.TURBOGRAFX_CD, + UPS.TG16, + UPS.VIRTUALBOY, + UPS.WONDERSWAN, + UPS.WONDERSWAN_COLOR, ) ) WEBRCADE_SLUG_TO_TYPE_MAP = { - "atari2600": "2600", - "atari5200": "5200", - "atari7800": "7800", - "c64": "commodore-c64", - "lynx": "lnx", - "tg16": "pce", - "turbografx-cd": "pce", - "supergrafx": "sgx", - "pc-fx": "pcfx", - "virtualboy": "vb", - "gamegear": "gg", - "neogeoaes": "neogeo", - "neogeomvs": "neogeo", - "neo-geo-cd": "neogeocd", - "neo-geo-pocket": "ngp", - "neo-geo-pocket-color": "ngc", + UPS.ATARI2600: "2600", + UPS.ATARI5200: "5200", + UPS.ATARI7800: "7800", + UPS.C64: "commodore-c64", + UPS.LYNX: "lnx", + UPS.TG16: "pce", + UPS.TURBOGRAFX_CD: "pce", + UPS.SUPERGRAFX: "sgx", + UPS.PC_FX: "pcfx", + UPS.VIRTUALBOY: "vb", + UPS.GAMEGEAR: "gg", + UPS.NEOGEOAES: "neogeo", + UPS.NEOGEOMVS: "neogeo", + UPS.NEO_GEO_CD: "neogeocd", + UPS.NEO_GEO_POCKET: "ngp", + UPS.NEO_GEO_POCKET_COLOR: "ngc", } diff --git a/backend/handler/database/roms_handler.py b/backend/handler/database/roms_handler.py index 237455cd0..d25d4ac63 100644 --- a/backend/handler/database/roms_handler.py +++ b/backend/handler/database/roms_handler.py @@ -3,6 +3,7 @@ from collections.abc import Iterable, Sequence from config import ROMM_DB_DRIVER from decorators.database import begin_session +from handler.metadata.base_hander import UniversalPlatformSlug as UPS from models.collection import Collection, VirtualCollection from models.platform import Platform from models.rom import Rom, RomFile, RomMetadata, RomUser @@ -29,77 +30,48 @@ from sqlalchemy.orm import InstrumentedAttribute, Query, Session, selectinload from .base_handler import DBBaseHandler EJS_SUPPORTED_PLATFORMS = [ - "3do", - "amiga", - "amiga-cd32", - "arcade", - "neogeoaes", - "neogeomvs", - "atari2600", - "atari-2600-plus", - "atari5200", - "atari7800", - "c-plus-4", - "c64", - "cpet", - "commodore-64c", - "c128", - "commmodore-128", - "colecovision", - "jaguar", - "lynx", - "atari-lynx-mkii", - "neo-geo-pocket", - "neo-geo-pocket-color", - "nes", - "famicom", - "fds", - "game-televisison", - "new-style-nes", - "n64", - "ique-player", - "nds", - "nintendo-ds-lite", - "nintendo-dsi", - "nintendo-dsi-xl", - "gb", - "game-boy-pocket", - "game-boy-light", - "gba", - "game-boy-adavance-sp", - "game-boy-micro", - "gbc", - "pc-fx", - "psx", - "psp", - "segacd", - "sega32", - "gamegear", - "sms", - "sega-mark-iii", - "sega-game-box-9", - "sega-master-system-ii", - "master-system-super-compact", - "master-system-girl", - "genesis", - "sega-mega-drive-2-slash-genesis", - "sega-mega-jet", - "mega-pc", - "tera-drive", - "sega-nomad", - "saturn", - "snes", - "sfam", - "super-nintendo-original-european-version", - "super-famicom-shvc-001", - "super-famicom-jr-model-shvc-101", - "new-style-super-nes-model-sns-101", - "tg16", - "vic-20", - "virtualboy", - "wonderswan", - "swancrystal", - "wonderswan-color", + UPS._3DO, + UPS.AMIGA, + UPS.AMIGA_CD32, + UPS.ARCADE, + UPS.NEOGEOAES, + UPS.NEOGEOMVS, + UPS.ATARI2600, + UPS.ATARI5200, + UPS.ATARI7800, + UPS.C_PLUS_4, + UPS.C64, + UPS.CPET, + UPS.C64, + UPS.C128, + UPS.COLECOVISION, + UPS.JAGUAR, + UPS.LYNX, + UPS.NEO_GEO_POCKET, + UPS.NEO_GEO_POCKET_COLOR, + UPS.NES, + UPS.FAMICOM, + UPS.FDS, + UPS.N64, + UPS.NDS, + UPS.NINTENDO_DSI, + UPS.GB, + UPS.GBA, + UPS.PC_FX, + UPS.PSX, + UPS.PSP, + UPS.SEGACD, + UPS.GENESIS, + UPS.SMS, + UPS.GAMEGEAR, + UPS.SATURN, + UPS.SNES, + UPS.SFAM, + UPS.TG16, + UPS.VIC_20, + UPS.VIRTUALBOY, + UPS.WONDERSWAN, + UPS.WONDERSWAN_COLOR, ] diff --git a/backend/handler/filesystem/roms_handler.py b/backend/handler/filesystem/roms_handler.py index e09ce838d..b00e3a065 100644 --- a/backend/handler/filesystem/roms_handler.py +++ b/backend/handler/filesystem/roms_handler.py @@ -20,6 +20,7 @@ from exceptions.fs_exceptions import ( RomAlreadyExistsException, RomsNotFoundException, ) +from handler.metadata.base_hander import UniversalPlatformSlug as UPS from models.platform import Platform from models.rom import Rom, RomFile, RomFileCategory from py7zr.exceptions import ( @@ -65,33 +66,32 @@ COMPRESSED_FILE_EXTENSIONS = frozenset( NON_HASHABLE_PLATFORMS = frozenset( ( - "amazon-alexa", - "amazon-fire-tv", - "android", - "gear-vr", - "ios", - "ipad", - "linux", - "mac", - "meta-quest-2", - "meta-quest-3", - "oculus-go", - "oculus-quest", - "oculus-rift", - "pc", - "ps3", - "ps4", - "ps4", - "ps5", - "psvr", - "psvr2", - "series-x-s", - "switch", - "wiiu", - "win", - "xbox-360", - "xbox360", - "xboxone", + UPS.AMAZON_ALEXA, + UPS.AMAZON_FIRE_TV, + UPS.ANDROID, + UPS.GEAR_VR, + UPS.IOS, + UPS.IPAD, + UPS.LINUX, + UPS.MAC, + UPS.META_QUEST_2, + UPS.META_QUEST_3, + UPS.OCULUS_GO, + UPS.OCULUS_QUEST, + UPS.OCULUS_RIFT, + UPS.PS3, + UPS.PS4, + UPS.PS5, + UPS.PSVR, + UPS.PSVR2, + UPS.SERIES_X_S, + UPS.SWITCH, + UPS.SWITCH_2, + UPS.WIIU, + UPS.WIN, + UPS.XBOX360, + UPS.XBOXONE, + UPS.SERIES_X_S, ) ) diff --git a/backend/utils/generate_supported_platforms.py b/backend/utils/generate_supported_platforms.py index 726b14400..09d0a9776 100644 --- a/backend/utils/generate_supported_platforms.py +++ b/backend/utils/generate_supported_platforms.py @@ -45,8 +45,8 @@ if __name__ == "__main__": or ra_platform.get("name", None) or slug_lower.replace("-", " ").title(), "folder": slug_lower, - "igdb_slug": igdb_platform["slug"], - "moby_slug": moby_platform["slug"], + "igdb_slug": igdb_platform.get("igdb_slug", None), + "moby_slug": moby_platform.get("moby_slug", None), "ss_id": ss_platform["ss_id"], "launchbox_id": launchbox_platform["launchbox_id"], "hasheous_id": hasheous_platform["hasheous_id"], diff --git a/frontend/assets/platforms/apple-i.ico b/frontend/assets/platforms/apple.ico similarity index 100% rename from frontend/assets/platforms/apple-i.ico rename to frontend/assets/platforms/apple.ico diff --git a/frontend/assets/platforms/apple-i.svg b/frontend/assets/platforms/apple.svg similarity index 100% rename from frontend/assets/platforms/apple-i.svg rename to frontend/assets/platforms/apple.svg diff --git a/frontend/assets/platforms/genesis-slash-megadrive.ico b/frontend/assets/platforms/genesis.ico similarity index 100% rename from frontend/assets/platforms/genesis-slash-megadrive.ico rename to frontend/assets/platforms/genesis.ico diff --git a/frontend/assets/platforms/pc-98.ico b/frontend/assets/platforms/pc-9800-series.ico similarity index 100% rename from frontend/assets/platforms/pc-98.ico rename to frontend/assets/platforms/pc-9800-series.ico diff --git a/frontend/assets/platforms/ps.ico b/frontend/assets/platforms/psx.ico similarity index 100% rename from frontend/assets/platforms/ps.ico rename to frontend/assets/platforms/psx.ico diff --git a/frontend/assets/platforms/ps.svg b/frontend/assets/platforms/psx.svg similarity index 100% rename from frontend/assets/platforms/ps.svg rename to frontend/assets/platforms/psx.svg diff --git a/frontend/assets/platforms/systematic/apple-i.svg b/frontend/assets/platforms/systematic/apple.svg similarity index 100% rename from frontend/assets/platforms/systematic/apple-i.svg rename to frontend/assets/platforms/systematic/apple.svg diff --git a/frontend/assets/platforms/systematic/genesis-slash-megadrive.svg b/frontend/assets/platforms/systematic/genesis.svg similarity index 100% rename from frontend/assets/platforms/systematic/genesis-slash-megadrive.svg rename to frontend/assets/platforms/systematic/genesis.svg diff --git a/frontend/assets/platforms/systematic/pc-98.svg b/frontend/assets/platforms/systematic/pc-9800-series.svg similarity index 100% rename from frontend/assets/platforms/systematic/pc-98.svg rename to frontend/assets/platforms/systematic/pc-9800-series.svg diff --git a/frontend/assets/platforms/systematic/ps.svg b/frontend/assets/platforms/systematic/psx.svg similarity index 100% rename from frontend/assets/platforms/systematic/ps.svg rename to frontend/assets/platforms/systematic/psx.svg diff --git a/frontend/assets/platforms/systematic/sega-32x.svg b/frontend/assets/platforms/systematic/sega-32x.svg deleted file mode 100755 index 2ac55e3a5..000000000 --- a/frontend/assets/platforms/systematic/sega-32x.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/frontend/assets/platforms/systematic/sinclair-zx81.svg b/frontend/assets/platforms/systematic/zx81.svg similarity index 100% rename from frontend/assets/platforms/systematic/sinclair-zx81.svg rename to frontend/assets/platforms/systematic/zx81.svg diff --git a/frontend/assets/webrcade/feed/genesis-slash-megadrive-background.png b/frontend/assets/webrcade/feed/genesis-slash-megadrive-background.png deleted file mode 100644 index 4c5f186e4..000000000 Binary files a/frontend/assets/webrcade/feed/genesis-slash-megadrive-background.png and /dev/null differ diff --git a/frontend/assets/webrcade/feed/genesis-slash-megadrive-thumb.png b/frontend/assets/webrcade/feed/genesis.png similarity index 100% rename from frontend/assets/webrcade/feed/genesis-slash-megadrive-thumb.png rename to frontend/assets/webrcade/feed/genesis.png