add scripts folder

This commit is contained in:
Georges-Antoine Assi
2024-04-03 17:10:44 -04:00
parent 8271645f22
commit 577bf3e8e8
5 changed files with 345 additions and 4 deletions

View File

@@ -614,3 +614,228 @@ GAMES_FIELDS = [
"similar_games.name",
"similar_games.cover.url",
]
# Generated from the following code on https://www.igdb.com/platforms/:
# Array.from(document.querySelectorAll(".media-body a")).map(a => ({
# slug: a.href.split("/")[4],
# name: a.innerText
# }))
IGDB_PLATFORM_LIST = [
{"slug": "visionos", "name": "visionOS"},
{"slug": "meta-quest-3", "name": "Meta Quest 3"},
{"slug": "atari2600", "name": "Atari 2600"},
{"slug": "psvr2", "name": "PlayStation VR2"},
{"slug": "switch", "name": "Nintendo Switch"},
{"slug": "evercade", "name": "Evercade"},
{"slug": "android", "name": "Android"},
{"slug": "mac", "name": "Mac"},
{"slug": "win", "name": "PC (Microsoft Windows)"},
{"slug": "oculus-quest", "name": "Oculus Quest"},
{"slug": "playdate", "name": "Playdate"},
{"slug": "series-x", "name": "Xbox Series X"},
{"slug": "meta-quest-2", "name": "Meta Quest 2"},
{"slug": "ps5", "name": "PlayStation 5"},
{"slug": "oculus-rift", "name": "Oculus Rift"},
{"slug": "xboxone", "name": "Xbox One"},
{"slug": "leaptv", "name": "LeapTV"},
{"slug": "new-nintendo-3ds", "name": "New Nintendo 3DS"},
{"slug": "gear-vr", "name": "Gear VR"},
{"slug": "psvr", "name": "PlayStation VR"},
{"slug": "3ds", "name": "Nintendo 3DS"},
{"slug": "winphone", "name": "Windows Phone"},
{"slug": "arduboy", "name": "Arduboy"},
{"slug": "ps4--1", "name": "PlayStation 4"},
{"slug": "oculus-go", "name": "Oculus Go"},
{"slug": "psvita", "name": "PlayStation Vita"},
{"slug": "wiiu", "name": "Wii U"},
{"slug": "ouya", "name": "Ouya"},
{"slug": "wii", "name": "Wii"},
{"slug": "ps3", "name": "PlayStation 3"},
{"slug": "psp", "name": "PlayStation Portable"},
{"slug": "nintendo-dsi", "name": "Nintendo DSi"},
{
"slug": "leapster-explorer-slash-leadpad-explorer",
"name": "Leapster Explorer/LeadPad Explorer",
},
{"slug": "xbox360", "name": "Xbox 360"},
{"slug": "nds", "name": "Nintendo DS"},
{"slug": "ps2", "name": "PlayStation 2"},
{"slug": "arcade", "name": "Arcade"},
{"slug": "zeebo", "name": "Zeebo"},
{"slug": "windows-mobile", "name": "Windows Mobile"},
{"slug": "ios", "name": "iOS"},
{"slug": "mobile", "name": "Legacy Mobile Device"},
{"slug": "blu-ray-player", "name": "Blu-ray Player"},
{"slug": "hyperscan", "name": "HyperScan"},
{"slug": "gizmondo", "name": "Gizmondo"},
{"slug": "gba", "name": "Game Boy Advance"},
{"slug": "ngage", "name": "N-Gage"},
{"slug": "vsmile", "name": "V.Smile"},
{"slug": "n64", "name": "Nintendo 64"},
{"slug": "leapster", "name": "Leapster"},
{"slug": "zod", "name": "Tapwave Zodiac"},
{"slug": "wonderswan-color", "name": "WonderSwan Color"},
{"slug": "xbox", "name": "Xbox"},
{"slug": "ngc", "name": "Nintendo GameCube"},
{"slug": "wonderswan", "name": "WonderSwan"},
{"slug": "pokemon-mini", "name": "Pokémon mini"},
{"slug": "nuon", "name": "Nuon"},
{"slug": "ps", "name": "PlayStation"},
{"slug": "nintendo-64dd", "name": "Nintendo 64DD"},
{"slug": "neo-geo-pocket-color", "name": "Neo Geo Pocket Color"},
{"slug": "dvd-player", "name": "DVD Player"},
{"slug": "pocketstation", "name": "PocketStation"},
{
"slug": "visual-memory-unit-slash-visual-memory-system",
"name": "Visual Memory Unit / Visual Memory System",
},
{"slug": "blackberry", "name": "BlackBerry OS"},
{"slug": "dc", "name": "Dreamcast"},
{"slug": "gbc", "name": "Game Boy Color"},
{"slug": "gb", "name": "Game Boy"},
{"slug": "neo-geo-pocket", "name": "Neo Geo Pocket"},
{"slug": "snes", "name": "Super Nintendo Entertainment System"},
{"slug": "genesis-slash-megadrive", "name": "Sega Mega Drive/Genesis"},
{"slug": "sfam", "name": "Super Famicom"},
{"slug": "game-dot-com", "name": "Game.com"},
{"slug": "hyper-neo-geo-64", "name": "Hyper Neo Geo 64"},
{"slug": "satellaview", "name": "Satellaview"},
{"slug": "palm-os", "name": "Palm OS"},
{"slug": "apple-pippin", "name": "Apple Pippin"},
{"slug": "sega32", "name": "Sega 32X"},
{"slug": "neo-geo-cd", "name": "Neo Geo CD"},
{"slug": "virtualboy", "name": "Virtual Boy"},
{"slug": "atari-jaguar-cd", "name": "Atari Jaguar CD"},
{"slug": "saturn", "name": "Sega Saturn"},
{"slug": "casio-loopy", "name": "Casio Loopy"},
{"slug": "sega-pico", "name": "Sega Pico"},
{"slug": "r-zone", "name": "R-Zone"},
{"slug": "sms", "name": "Sega Master System/Mark III"},
{"slug": "playdia", "name": "Playdia"},
{"slug": "pc-fx", "name": "PC-FX"},
{"slug": "3do", "name": "3DO Interactive Multiplayer"},
{
"slug": "terebikko-slash-see-n-say-video-phone",
"name": "Terebikko / See 'n Say Video Phone",
},
{"slug": "jaguar", "name": "Atari Jaguar"},
{"slug": "segacd", "name": "Sega CD"},
{"slug": "nes", "name": "Nintendo Entertainment System"},
{"slug": "amiga-cd32", "name": "Amiga CD32"},
{"slug": "famicom", "name": "Family Computer"},
{"slug": "mega-duck-slash-cougar-boy", "name": "Mega Duck/Cougar Boy"},
{"slug": "amiga", "name": "Amiga"},
{
"slug": "watara-slash-quickshot-supervision",
"name": "Watara/QuickShot Supervision",
},
{"slug": "philips-cd-i", "name": "Philips CD-i"},
{"slug": "gamegear", "name": "Sega Game Gear"},
{"slug": "neogeoaes", "name": "Neo Geo AES"},
{"slug": "linux", "name": "Linux"},
{"slug": "turbografx-16-slash-pc-engine-cd", "name": "Turbografx-16/PC Engine CD"},
{"slug": "neogeomvs", "name": "Neo Geo MVS"},
{"slug": "commodore-cdtv", "name": "Commodore CDTV"},
{"slug": "lynx", "name": "Atari Lynx"},
{"slug": "gamate", "name": "Gamate"},
{"slug": "bbcmicro", "name": "BBC Microcomputer System"},
{"slug": "turbografx16--1", "name": "TurboGrafx-16/PC Engine"},
{"slug": "supergrafx", "name": "PC Engine SuperGrafx"},
{"slug": "fm-towns", "name": "FM Towns"},
{"slug": "pc-9800-series", "name": "PC-9800 Series"},
{"slug": "apple-iigs", "name": "Apple IIGS"},
{"slug": "x1", "name": "Sharp X1"},
{"slug": "sharp-x68000", "name": "Sharp X68000"},
{"slug": "acorn-archimedes", "name": "Acorn Archimedes"},
{"slug": "c64", "name": "Commodore C64/128/MAX"},
{"slug": "fds", "name": "Family Computer Disk System"},
{"slug": "dragon-32-slash-64", "name": "Dragon 32/64"},
{"slug": "acorn-electron", "name": "Acorn Electron"},
{"slug": "acpc", "name": "Amstrad CPC"},
{"slug": "atari-st", "name": "Atari ST/STE"},
{"slug": "tatung-einstein", "name": "Tatung Einstein"},
{"slug": "amstrad-pcw", "name": "Amstrad PCW"},
{"slug": "epoch-super-cassette-vision", "name": "Epoch Super Cassette Vision"},
{"slug": "atari7800", "name": "Atari 7800"},
{"slug": "hp3000", "name": "HP 3000"},
{"slug": "atari5200", "name": "Atari 5200"},
{"slug": "c16", "name": "Commodore 16"},
{"slug": "sinclair-ql", "name": "Sinclair QL"},
{"slug": "thomson-mo5", "name": "Thomson MO5"},
{"slug": "c-plus-4", "name": "Commodore Plus/4"},
{"slug": "sg1000", "name": "SG-1000"},
{"slug": "vectrex", "name": "Vectrex"},
{"slug": "sharp-mz-2200", "name": "Sharp MZ-2200"},
{"slug": "nec-pc-6000-series", "name": "NEC PC-6000 Series"},
{"slug": "msx2", "name": "MSX2"},
{"slug": "msx", "name": "MSX"},
{"slug": "colecovision", "name": "ColecoVision"},
{"slug": "intellivision", "name": "Intellivision"},
{"slug": "vic-20", "name": "Commodore VIC-20"},
{"slug": "zxs", "name": "ZX Spectrum"},
{"slug": "arcadia-2001", "name": "Arcadia 2001"},
{"slug": "fm-7", "name": "FM-7"},
{"slug": "trs-80", "name": "TRS-80"},
{"slug": "epoch-cassette-vision", "name": "Epoch Cassette Vision"},
{"slug": "dos", "name": "DOS"},
{"slug": "ti-99", "name": "Texas Instruments TI-99"},
{"slug": "sinclair-zx81", "name": "Sinclair ZX81"},
{"slug": "pc-8800-series", "name": "PC-8800 Series"},
{"slug": "microvision--1", "name": "Microvision"},
{"slug": "game-and-watch", "name": "Game & Watch"},
{"slug": "atari8bit", "name": "Atari 8-bit"},
{"slug": "trs-80-color-computer", "name": "TRS-80 Color Computer"},
{
"slug": "1292-advanced-programmable-video-system",
"name": "1292 Advanced Programmable Video System",
},
{"slug": "odyssey-2-slash-videopac-g7000", "name": "Odyssey 2 / Videopac G7000"},
{"slug": "exidy-sorcerer", "name": "Exidy Sorcerer"},
{"slug": "pc-50x-family", "name": "PC-50X Family"},
{"slug": "vc-4000", "name": "VC 4000"},
{"slug": "appleii", "name": "Apple II"},
{"slug": "astrocade", "name": "Bally Astrocade"},
{"slug": "ay-3-8500", "name": "AY-3-8500"},
{"slug": "cpet", "name": "Commodore PET"},
{"slug": "fairchild-channel-f", "name": "Fairchild Channel F"},
{"slug": "ay-3-8610", "name": "AY-3-8610"},
{"slug": "ay-3-8605", "name": "AY-3-8605"},
{"slug": "ay-3-8603", "name": "AY-3-8603"},
{"slug": "ay-3-8710", "name": "AY-3-8710"},
{"slug": "ay-3-8760", "name": "AY-3-8760"},
{"slug": "ay-3-8606", "name": "AY-3-8606"},
{"slug": "ay-3-8607", "name": "AY-3-8607"},
{"slug": "sol-20", "name": "Sol-20"},
{"slug": "odyssey--1", "name": "Odyssey"},
{"slug": "plato--1", "name": "PLATO"},
{"slug": "cdccyber70", "name": "CDC Cyber 70"},
{"slug": "sdssigma7", "name": "SDS Sigma 7"},
{"slug": "pdp11", "name": "PDP-11"},
{"slug": "hp2100", "name": "HP 2100"},
{"slug": "pdp10", "name": "PDP-10"},
{
"slug": "call-a-computer",
"name": "Call-A-Computer time-shared mainframe computer system",
},
{"slug": "pdp-8--1", "name": "PDP-8"},
{"slug": "nintendo-playstation", "name": "Nintendo PlayStation"},
{"slug": "pdp1", "name": "PDP-1"},
{"slug": "donner30", "name": "Donner Model 30"},
{"slug": "edsac--1", "name": "EDSAC"},
{"slug": "nimrod", "name": "Ferranti Nimrod Computer"},
{"slug": "swancrystal", "name": "SwanCrystal"},
{"slug": "panasonic-jungle", "name": "Panasonic Jungle"},
{"slug": "handheld-electronic-lcd", "name": "Handheld Electronic LCD"},
{"slug": "intellivision-amico", "name": "Intellivision Amico"},
{"slug": "legacy-computer", "name": "Legacy Computer"},
{"slug": "panasonic-m2", "name": "Panasonic M2"},
{"slug": "browser", "name": "Web browser"},
{"slug": "ooparts", "name": "OOParts"},
{"slug": "stadia", "name": "Google Stadia"},
{"slug": "plug-and-play", "name": "Plug & Play"},
{"slug": "amazon-fire-tv", "name": "Amazon Fire TV"},
{"slug": "onlive-game-system", "name": "OnLive Game System"},
{"slug": "vc", "name": "Virtual Console"},
{"slug": "airconsole", "name": "AirConsole"},
]

View File

@@ -108,7 +108,7 @@ class MobyGamesHandler(MetadataHandler):
if err.response.status_code == 401:
# Sometimes Mobygames returns 401 even with a valid API key
return {}
# Log the error and return an empty dict if the request fails with a different code
log.error(err)
return {}
@@ -610,7 +610,6 @@ SLUG_TO_MOBY_ID: Final = {
"sri-5001000": {"id": 242, "name": "SRI-500/1000"},
"swtpc-6800": {"id": 228, "name": "SWTPC 6800"},
"sharp-mz-80b20002500": {"id": 182, "name": "Sharp MZ-80B/2000/2500"},
"sharp-mz-2200": {"id": 180, "name": "Sharp MZ-2200"},
"sharp-mz-80k7008001500": {"id": 181, "name": "Sharp MZ-80K/700/800/1500"},
"sharp-x1": {"id": 121, "name": "Sharp X1"},
"x1": {"id": 121, "name": "Sharp X1"}, # IGDB
@@ -632,7 +631,7 @@ SLUG_TO_MOBY_ID: Final = {
"tads": {"id": 171, "name": "TADS"},
"ti-programmable-calculator": {"id": 239, "name": "TI Programmable Calculator"},
"ti-994a": {"id": 47, "name": "TI-99/4A"},
"ti-99": {"id": 47, "name": "TI-99/4A"},
"ti-99": {"id": 47, "name": "TI-99/4A"}, # IGDB
"tim": {"id": 246, "name": "TIM"},
"trs-80": {"id": 58, "name": "TRS-80"},
"trs-80-coco": {"id": 62, "name": "TRS-80 Color Computer"},

View File

View File

@@ -0,0 +1,117 @@
# poetry_npm run python3 -m scripts.generate_supported_platforms
from handler.metadata_handler.igdb_handler import IGDB_PLATFORM_LIST
from handler.metadata_handler.moby_handler import SLUG_TO_MOBY_ID
IGDB_SLUG_TO_MOBY_SLUG = {
"bbcmicro": "bbc-micro",
"astrocade": "bally-astrocade",
"blu-ray-player": "blu-ray-disc-player",
"amazon-fire-tv": "fire-os",
"acpc": "cpc",
"appleii": "apple-ii",
"apple-iigs": "apple-iigs",
"atari2600": "atari-2600",
"atari5200": "atari-5200",
"atari7800": "atari-7800",
"atari8bit": "atari-8-bit",
"acorn-archimedes": "acorn-32-bit",
"acorn-electron": "electron",
"c16": "commodore-16-plus4",
"commodore-cdtv": "cdtv",
"cpet": "pet",
"c-plus-4": "commodore-16-plus4",
"dc": "dreamcast",
"fm-towns": "fmtowns",
"fairchild-channel-f": "channel-f",
"game-dot-com": "game-com",
"gb": "gameboy",
"gbc": "gameboy-color",
"gba": "gameboy-advance",
"leapster-explorer-slash-leadpad-explorer": "leapfrog-explorer",
"mac": "macintosh",
"microvision--1": "microvision",
"ngc": "gamecube",
"nds": "nintendo-ds",
"neogeomvs": "neo-geo",
"neogeoaes": "neo-geo",
"win": "windows",
"onlive-game-system": "onlive",
"odyssey-2-slash-videopac-g7000": "odyssey-2",
"odyssey--1": "odyssey",
"pc-8800-series": "pc88",
"pc-9800-series": "pc98",
"palm-os": "palmos",
"philips-cd-i": "cd-i",
"ps": "playstation",
"ps4--1": "playstation-4",
"ps5": "playstation-5",
"psvita": "ps-vita",
"sega32x": "sega-32x",
"segacd": "sega-cd",
"gamegear": "game-gear",
"genesis-slash-megadrive": "genesis",
"saturn": "sega-saturn",
"x1": "sharp-x1",
"sinclair-zx81": "zx81",
"trs-80-color-computer": "trs-80-coco",
"ti-994a": "ti-994a",
"thomson-mo5": "thomson-mo",
"turbografx16--1": "turbo-grafx",
"turbografx-16-slash-pc-engine-cd": "turbografx-cd",
"virtualboy": "virtual-boy",
"wiiu": "wii-u",
"series-x": "xbox-series",
"ios": "iphone",
"windows-mobile": "windowsphone",
"winphone": "windows-phone",
"xboxone": "xbox-one",
}
if __name__ == "__main__":
supported_platforms = {}
matched_moby_slugs = []
for platform in IGDB_PLATFORM_LIST:
moby_slug = platform["slug"] if platform["slug"] in SLUG_TO_MOBY_ID else None
moby_slug = IGDB_SLUG_TO_MOBY_SLUG.get(platform["slug"], moby_slug)
supported_platforms[platform["name"]] = {
"name": platform["name"],
"igdb_slug": platform["slug"],
"moby_slug": moby_slug,
}
if moby_slug:
matched_moby_slugs.append(moby_slug)
# Now go over the moby ids
for slug, platform in SLUG_TO_MOBY_ID.items():
if (
platform["name"] not in supported_platforms
and platform["name"].lower() not in supported_platforms
and slug not in matched_moby_slugs
):
supported_platforms[platform["name"]] = {
"name": platform["name"],
"igdb_slug": None,
"moby_slug": slug,
}
# Sort platforms by key
supported_platforms = dict(sorted(supported_platforms.items()))
print("Below is a list of all supported platforms/systems/consoles and their respective folder names. **The folder name is case-sensitive and must be used exactly as it appears in the list below.**")
print("\n")
print("|Platform Name|Folder Name|IGDB|Mobygames|")
print("|---|---|---|---|")
for platform in supported_platforms.values():
print(
f'{platform["name"]} |',
f'`{platform["igdb_slug"] or platform["moby_slug"]}` |',
f'<a href="https://www.igdb.com/platforms/{platform["igdb_slug"]}" target="_blank" rel="noopener norefer">IGDB</a>|'
if platform["igdb_slug"]
else " |",
f'<a href="https://www.mobygames.com/platform/{platform["moby_slug"]}" target="_blank" rel="noopener norefer">Mobygames</a>'
if platform["moby_slug"]
else " |",
)

View File

@@ -21,7 +21,7 @@ const theme = useTheme();
const emitter = inject<Emitter<Events>>("emitter");
emitter?.on("showSearchRomDialog", (romToSearch) => {
rom.value = romToSearch;
searchTerm.value = romToSearch.file_name_no_tags || romToSearch.name || "";
searchTerm.value = romToSearch.name || romToSearch.file_name_no_tags || "";
show.value = true;
searchRom();
});