mirror of
https://github.com/rommapp/romm.git
synced 2026-12-05 05:07:31 +01:00
complete launchbox handler
This commit is contained in:
56
backend/alembic/versions/0041_launchbox_id.py
Normal file
56
backend/alembic/versions/0041_launchbox_id.py
Normal file
@@ -0,0 +1,56 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 0041_launchbox_id
|
||||
Revises: 0040_migrate_assets_paths
|
||||
Create Date: 2025-05-20 22:39:16.993191
|
||||
|
||||
"""
|
||||
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
revision = "0041_launchbox_id"
|
||||
down_revision = "0040_migrate_assets_paths"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
with op.batch_alter_table("rom_user", schema=None) as batch_op:
|
||||
batch_op.drop_column("ra_metadata")
|
||||
|
||||
with op.batch_alter_table("roms", schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column("launchbox_id", sa.Integer(), nullable=True))
|
||||
batch_op.add_column(
|
||||
sa.Column(
|
||||
"launchbox_metadata",
|
||||
sa.JSON().with_variant(
|
||||
postgresql.JSONB(astext_type=sa.Text()), "postgresql"
|
||||
),
|
||||
nullable=True,
|
||||
)
|
||||
)
|
||||
batch_op.create_index("idx_roms_launchbox_id", ["launchbox_id"], unique=False)
|
||||
batch_op.create_index("idx_roms_ra_id", ["ra_id"], unique=False)
|
||||
batch_op.create_index("idx_roms_sgdb_id", ["sgdb_id"], unique=False)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
|
||||
with op.batch_alter_table("roms", schema=None) as batch_op:
|
||||
batch_op.drop_index("idx_roms_sgdb_id")
|
||||
batch_op.drop_index("idx_roms_ra_id")
|
||||
batch_op.drop_index("idx_roms_launchbox_id")
|
||||
batch_op.drop_column("launchbox_metadata")
|
||||
batch_op.drop_column("launchbox_id")
|
||||
|
||||
with op.batch_alter_table("rom_user", schema=None) as batch_op:
|
||||
batch_op.add_column(
|
||||
sa.Column(
|
||||
"ra_metadata",
|
||||
postgresql.JSONB(astext_type=sa.Text()),
|
||||
autoincrement=False,
|
||||
nullable=True,
|
||||
)
|
||||
)
|
||||
@@ -36,7 +36,12 @@ from handler.database import db_platform_handler, db_rom_handler
|
||||
from handler.database.base_handler import sync_session
|
||||
from handler.filesystem import fs_resource_handler, fs_rom_handler
|
||||
from handler.filesystem.base_handler import CoverSize
|
||||
from handler.metadata import meta_igdb_handler, meta_moby_handler, meta_ss_handler
|
||||
from handler.metadata import (
|
||||
meta_igdb_handler,
|
||||
meta_launchbox_handler,
|
||||
meta_moby_handler,
|
||||
meta_ss_handler,
|
||||
)
|
||||
from logger.formatter import BLUE
|
||||
from logger.formatter import highlight as hl
|
||||
from logger.logger import log
|
||||
@@ -586,6 +591,20 @@ async def update_rom(
|
||||
)
|
||||
cleaned_data.update({"path_screenshots": path_screenshots})
|
||||
|
||||
if (
|
||||
cleaned_data.get("launchbox_id", "")
|
||||
and int(cleaned_data.get("launchbox_id", "")) != rom.launchbox_id
|
||||
):
|
||||
igdb_rom = await meta_launchbox_handler.get_rom_by_id(
|
||||
cleaned_data["launchbox_id"]
|
||||
)
|
||||
cleaned_data.update(igdb_rom)
|
||||
path_screenshots = await fs_resource_handler.get_rom_screenshots(
|
||||
rom=rom,
|
||||
url_screenshots=cleaned_data.get("url_screenshots", []),
|
||||
)
|
||||
cleaned_data.update({"path_screenshots": path_screenshots})
|
||||
|
||||
cleaned_data.update(
|
||||
{
|
||||
"name": data.get("name", rom.name),
|
||||
@@ -714,7 +733,7 @@ async def add_rom_manuals(request: Request, id: int):
|
||||
|
||||
manuals_path = f"{RESOURCES_BASE_PATH}/{rom.fs_resources_path}/manual"
|
||||
file_location = Path(f"{manuals_path}/{rom.id}.pdf")
|
||||
log.info(f"Uploading {hl(file_location)}")
|
||||
log.info(f"Uploading {hl(str(file_location))}")
|
||||
|
||||
if not os.path.exists(manuals_path):
|
||||
await Path(manuals_path).mkdir(parents=True, exist_ok=True)
|
||||
@@ -778,7 +797,7 @@ async def delete_roms(
|
||||
raise RomNotFoundInDatabaseException(id)
|
||||
|
||||
log.info(
|
||||
f"Deleting {hl(rom.name, color=BLUE)} [{hl(rom.fs_name)}] from database"
|
||||
f"Deleting {hl(rom.name or 'ROM', color=BLUE)} [{hl(rom.fs_name)}] from database"
|
||||
)
|
||||
db_rom_handler.delete_rom(id)
|
||||
|
||||
@@ -786,7 +805,7 @@ async def delete_roms(
|
||||
rmtree(f"{RESOURCES_BASE_PATH}/{rom.fs_resources_path}")
|
||||
except FileNotFoundError:
|
||||
log.error(
|
||||
f"Couldn't find resources to delete for {hl(rom.name, color=BLUE)}"
|
||||
f"Couldn't find resources to delete for {hl(rom.name or 'ROM', color=BLUE)}"
|
||||
)
|
||||
|
||||
if id in delete_from_fs:
|
||||
|
||||
@@ -34,6 +34,7 @@ class LaunchboxMetadata(TypedDict):
|
||||
|
||||
|
||||
class LaunchboxRom(TypedDict):
|
||||
launchbox_id: int | None
|
||||
name: NotRequired[str]
|
||||
summary: NotRequired[str]
|
||||
url_cover: NotRequired[str]
|
||||
@@ -91,16 +92,17 @@ class LaunchboxHandler(MetadataHandler):
|
||||
from handler.filesystem import fs_rom_handler
|
||||
|
||||
if not LAUNCHBOX_API_ENABLED:
|
||||
return LaunchboxRom()
|
||||
return LaunchboxRom(launchbox_id=None)
|
||||
|
||||
search_term = fs_rom_handler.get_file_name_with_no_extension(fs_name)
|
||||
fallback_rom = LaunchboxRom()
|
||||
fallback_rom = LaunchboxRom(launchbox_id=None)
|
||||
|
||||
index_entry = await self._search_rom(search_term)
|
||||
if not index_entry:
|
||||
return fallback_rom
|
||||
|
||||
rom = {
|
||||
"launchbox_id": index_entry["DatabaseID"],
|
||||
"name": index_entry["Name"],
|
||||
"summary": index_entry.get("Overview", ""),
|
||||
"launchbox_metadata": extract_metadata_from_launchbox_rom(index_entry),
|
||||
@@ -110,16 +112,17 @@ class LaunchboxHandler(MetadataHandler):
|
||||
|
||||
async def get_rom_by_id(self, database_id: int) -> LaunchboxRom:
|
||||
if not LAUNCHBOX_API_ENABLED:
|
||||
return LaunchboxRom()
|
||||
return LaunchboxRom(launchbox_id=None)
|
||||
|
||||
metadata_database_index_entry = await async_cache.hget(
|
||||
LAUNCHBOX_METADATA_DATABASE_ID_KEY, str(database_id)
|
||||
)
|
||||
|
||||
if not metadata_database_index_entry:
|
||||
return LaunchboxRom()
|
||||
return LaunchboxRom(launchbox_id=None)
|
||||
|
||||
rom = {
|
||||
"launchbox_id": database_id,
|
||||
"name": metadata_database_index_entry["Name"],
|
||||
"summary": metadata_database_index_entry.get("Overview", ""),
|
||||
"launchbox_metadata": extract_metadata_from_launchbox_rom(
|
||||
@@ -196,139 +199,139 @@ SLUG_TO_LAUNCHBOX_PLATFORM_NAME = {
|
||||
"fm-towns": "Fujitsu FM Towns Marty",
|
||||
"fm-7": "Fujitsu FM-7",
|
||||
"super-acan": "Funtech Super Acan",
|
||||
"": "GCE Vectrex",
|
||||
"": "Game Wave Family Entertainment System",
|
||||
"": "GamePark GP32",
|
||||
"": "GameWave",
|
||||
"": "Hartung Game Master",
|
||||
"": "Hector HRX",
|
||||
"vectrex": "GCE Vectrex",
|
||||
# "game-wave": "Game Wave Family Entertainment System",
|
||||
"gp32": "GamePark GP32",
|
||||
"game-wave": "GameWave",
|
||||
"hartung": "Hartung Game Master",
|
||||
"hrx": "Hector HRX",
|
||||
"vc-4000": "Interton VC 4000",
|
||||
"": "Jupiter Ace",
|
||||
"": "Linux",
|
||||
"": "MS-DOS",
|
||||
"": "MUGEN",
|
||||
"": "Magnavox Odyssey",
|
||||
"": "Magnavox Odyssey 2",
|
||||
"": "Matra and Hachette Alice",
|
||||
"": "Mattel Aquarius",
|
||||
"": "Mattel HyperScan",
|
||||
"": "Mattel Intellivision",
|
||||
"": "Mega Duck",
|
||||
"": "Memotech MTX512",
|
||||
"": "Microsoft MSX",
|
||||
"": "Microsoft MSX2",
|
||||
"": "Microsoft MSX2+",
|
||||
"": "Microsoft Xbox",
|
||||
"": "Microsoft Xbox 360",
|
||||
"": "Microsoft Xbox One",
|
||||
"": "Microsoft Xbox Series X/S",
|
||||
"": "NEC PC-8801",
|
||||
"": "NEC PC-9801",
|
||||
"": "NEC PC-FX",
|
||||
"": "NEC TurboGrafx-16",
|
||||
"": "NEC TurboGrafx-CD",
|
||||
"": "Namco System 22",
|
||||
"": "Nintendo 3DS",
|
||||
"": "Nintendo 64",
|
||||
"": "Nintendo 64DD",
|
||||
"": "Nintendo DS",
|
||||
"": "Nintendo Entertainment System",
|
||||
"": "Nintendo Famicom Disk System",
|
||||
"": "Nintendo Game & Watch",
|
||||
"": "Nintendo Game Boy",
|
||||
"": "Nintendo Game Boy Advance",
|
||||
"": "Nintendo Game Boy Color",
|
||||
"": "Nintendo GameCube",
|
||||
"": "Nintendo Pokemon Mini",
|
||||
"": "Nintendo Satellaview",
|
||||
"": "Nintendo Switch",
|
||||
"": "Nintendo Switch 2",
|
||||
"": "Nintendo Virtual Boy",
|
||||
"": "Nintendo Wii",
|
||||
"": "Nintendo Wii U",
|
||||
"": "Nokia N-Gage",
|
||||
"": "Nuon",
|
||||
"": "OpenBOR",
|
||||
"": "Oric Atmos",
|
||||
"": "Othello Multivision",
|
||||
"": "Ouya",
|
||||
"": "PC Engine SuperGrafx",
|
||||
"": "PICO-8",
|
||||
"": "Philips CD-i",
|
||||
"": "Philips VG 5000",
|
||||
"": "Philips Videopac+",
|
||||
"": "Pinball",
|
||||
"": "RCA Studio II",
|
||||
"": "SAM Coupé",
|
||||
"": "SNK Neo Geo AES",
|
||||
"": "SNK Neo Geo CD",
|
||||
"": "SNK Neo Geo MVS",
|
||||
"": "SNK Neo Geo Pocket",
|
||||
"": "SNK Neo Geo Pocket Color",
|
||||
"": "Sammy Atomiswave",
|
||||
"": "ScummVM",
|
||||
"": "Sega 32X",
|
||||
"": "Sega CD",
|
||||
"": "Sega CD 32X",
|
||||
"": "Sega Dreamcast",
|
||||
"": "Sega Dreamcast VMU",
|
||||
"": "Sega Game Gear",
|
||||
"": "Sega Genesis",
|
||||
"": "Sega Hikaru",
|
||||
"": "Sega Master System",
|
||||
"": "Sega Model 1",
|
||||
"": "Sega Model 2",
|
||||
"": "Sega Model 3",
|
||||
"": "Sega Naomi",
|
||||
"": "Sega Naomi 2",
|
||||
"": "Sega Pico",
|
||||
"": "Sega SC-3000",
|
||||
"": "Sega SG-1000",
|
||||
"": "Sega ST-V",
|
||||
"": "Sega Saturn",
|
||||
"": "Sega System 16",
|
||||
"": "Sega System 32",
|
||||
"": "Sega Triforce",
|
||||
"": "Sharp MZ-2500",
|
||||
"": "Sharp X1",
|
||||
"": "Sharp X68000",
|
||||
"": "Sinclair ZX Spectrum",
|
||||
"": "Sinclair ZX-81",
|
||||
"": "Sony PSP",
|
||||
"": "Sony PSP Minis",
|
||||
"": "Sony Playstation",
|
||||
"": "Sony Playstation 2",
|
||||
"": "Sony Playstation 3",
|
||||
"": "Sony Playstation 4",
|
||||
"": "Sony Playstation 5",
|
||||
"": "Sony Playstation Vita",
|
||||
"": "Sony PocketStation",
|
||||
"": "Sord M5",
|
||||
"": "Spectravideo",
|
||||
"": "Super Nintendo Entertainment System",
|
||||
"": "TRS-80 Color Computer",
|
||||
"": "Taito Type X",
|
||||
"": "Tandy TRS-80",
|
||||
"": "Tapwave Zodiac",
|
||||
"": "Texas Instruments TI 99/4A",
|
||||
"": "Tiger Game.com",
|
||||
"": "Tomy Tutor",
|
||||
"": "VTech CreatiVision",
|
||||
"": "VTech Socrates",
|
||||
"": "VTech V.Smile",
|
||||
"": "Vector-06C",
|
||||
"": "Watara Supervision",
|
||||
"": "Web Browser",
|
||||
"": "Windows",
|
||||
"": "Windows 3.X",
|
||||
"": "WoW Action Max",
|
||||
"": "WonderSwan",
|
||||
"": "WonderSwan Color",
|
||||
"": "XaviXPORT",
|
||||
"": "ZiNc",
|
||||
"jupiter-ace": "Jupiter Ace",
|
||||
"linux": "Linux",
|
||||
"dos": "MS-DOS",
|
||||
"mugen": "MUGEN",
|
||||
"odyssey--1": "Magnavox Odyssey",
|
||||
"odyssey-2-slash-videopac-g7000": "Magnavox Odyssey 2",
|
||||
"alice-3290": "Matra and Hachette Alice",
|
||||
"mattel-aquarius": "Mattel Aquarius",
|
||||
"hyperscan": "Mattel HyperScan",
|
||||
"intellivision": "Mattel Intellivision",
|
||||
"mega-duck-slash-cougar-boy": "Mega Duck",
|
||||
"mtx512": "Memotech MTX512",
|
||||
"msx": "Microsoft MSX",
|
||||
"msx2": "Microsoft MSX2",
|
||||
"msx2plus": "Microsoft MSX2+",
|
||||
"xbox": "Microsoft Xbox",
|
||||
"xbox360": "Microsoft Xbox 360",
|
||||
"xboxone": "Microsoft Xbox One",
|
||||
"series-x": "Microsoft Xbox Series X/S",
|
||||
"pc-8800-series": "NEC PC-8801",
|
||||
"pc-9800-series": "NEC PC-9801",
|
||||
"pc-fx": "NEC PC-FX",
|
||||
"turbografx16--1": "NEC TurboGrafx-16",
|
||||
"turbografx-16-slash-pc-engine-cd": "NEC TurboGrafx-CD",
|
||||
"system-32": "Namco System 22",
|
||||
"3ds": "Nintendo 3DS",
|
||||
"n64": "Nintendo 64",
|
||||
"64dd": "Nintendo 64DD",
|
||||
"nds": "Nintendo DS",
|
||||
"nes": "Nintendo Entertainment System",
|
||||
"famicom": "Nintendo Famicom Disk System",
|
||||
"g-and-w": "Nintendo Game & Watch",
|
||||
"gb": "Nintendo Game Boy",
|
||||
"gba": "Nintendo Game Boy Advance",
|
||||
"gbc": "Nintendo Game Boy Color",
|
||||
"ngc": "Nintendo GameCube",
|
||||
"pokemon-mini": "Nintendo Pokemon Mini",
|
||||
"satellaview": "Nintendo Satellaview",
|
||||
"switch": "Nintendo Switch",
|
||||
"switch2": "Nintendo Switch 2",
|
||||
"virtualboy": "Nintendo Virtual Boy",
|
||||
"wii": "Nintendo Wii",
|
||||
"wiiu": "Nintendo Wii U",
|
||||
"ngage": "Nokia N-Gage",
|
||||
"nuon": "Nuon",
|
||||
"openbor": "OpenBOR",
|
||||
"atmos": "Oric Atmos",
|
||||
"multivision": "Othello Multivision",
|
||||
"ouya": "Ouya",
|
||||
"supergrafx": "PC Engine SuperGrafx",
|
||||
"pico": "PICO-8",
|
||||
"philips-cd-i": "Philips CD-i",
|
||||
"philips-vg-5000": "Philips VG 5000",
|
||||
"videopac-g7400": "Philips Videopac+",
|
||||
"pinball": "Pinball",
|
||||
"rca-studio-ii": "RCA Studio II",
|
||||
"sam-coupe": "SAM Coupé",
|
||||
"neogeoaes": "SNK Neo Geo AES",
|
||||
"neo-geo-cd": "SNK Neo Geo CD",
|
||||
"neogeomvs": "SNK Neo Geo MVS",
|
||||
"neo-geo-pocket": "SNK Neo Geo Pocket",
|
||||
"neo-geo-pocket-color": "SNK Neo Geo Pocket Color",
|
||||
# "": "Sammy Atomiswave",
|
||||
"scummvm": "ScummVM",
|
||||
"sega32": "Sega 32X",
|
||||
"segacd": "Sega CD",
|
||||
"segacd32": "Sega CD 32X",
|
||||
"dc": "Sega Dreamcast",
|
||||
"vmu": "Sega Dreamcast VMU",
|
||||
"gamegear": "Sega Game Gear",
|
||||
"genesis-slash-megadrive": "Sega Genesis",
|
||||
"hikaru": "Sega Hikaru",
|
||||
"sms": "Sega Master System",
|
||||
"model1": "Sega Model 1",
|
||||
"model2": "Sega Model 2",
|
||||
"model3": "Sega Model 3",
|
||||
# "": "Sega Naomi",
|
||||
# "": "Sega Naomi 2",
|
||||
"sega-pico": "Sega Pico",
|
||||
"sc3000": "Sega SC-3000",
|
||||
"sg1000": "Sega SG-1000",
|
||||
"stv": "Sega ST-V",
|
||||
"saturn": "Sega Saturn",
|
||||
"system16": "Sega System 16",
|
||||
"system32": "Sega System 32",
|
||||
# "": "Sega Triforce",
|
||||
"sharp-mz-80b20002500": "Sharp MZ-2500",
|
||||
"x1": "Sharp X1",
|
||||
"sharp-x68000": "Sharp X68000",
|
||||
"zxs": "Sinclair ZX Spectrum",
|
||||
"sinclair-zx81": "Sinclair ZX-81",
|
||||
"psp": "Sony PSP",
|
||||
"psp-minis": "Sony PSP Minis",
|
||||
"ps": "Sony Playstation",
|
||||
"ps2": "Sony Playstation 2",
|
||||
"ps3": "Sony Playstation 3",
|
||||
"ps4--1": "Sony Playstation 4",
|
||||
"ps5": "Sony Playstation 5",
|
||||
"psvita": "Sony Playstation Vita",
|
||||
"pocketstation": "Sony PocketStation",
|
||||
"sord-m5": "Sord M5",
|
||||
"spectravideo": "Spectravideo",
|
||||
"snes": "Super Nintendo Entertainment System",
|
||||
"trs-80-color-computer": "TRS-80 Color Computer",
|
||||
"type-x": "Taito Type X",
|
||||
"trs-80": "Tandy TRS-80",
|
||||
"zod": "Tapwave Zodiac",
|
||||
"ti-994a": "Texas Instruments TI 99/4A",
|
||||
"game-dot-com": "Tiger Game.com",
|
||||
"tomy-tutor": "Tomy Tutor",
|
||||
"creativision": "VTech CreatiVision",
|
||||
"socrates": "VTech Socrates",
|
||||
"vsmile": "VTech V.Smile",
|
||||
"06c": "Vector-06C",
|
||||
"watara-slash-quickshot-supervision": "Watara Supervision",
|
||||
"browser": "Web Browser",
|
||||
"win": "Windows",
|
||||
"win3x": "Windows 3.X",
|
||||
"action-max": "WoW Action Max",
|
||||
"wonderswan": "WonderSwan",
|
||||
"wonderswan-color": "WonderSwan Color",
|
||||
"xavixport": "XaviXPORT",
|
||||
"zinc": "ZiNc",
|
||||
}
|
||||
|
||||
# Reverse lookup
|
||||
LAUNCHBOX_PLATFORM_NAME_TO_SLUG = {
|
||||
v["id"]: k for k, v in SLUG_TO_LAUNCHBOX_PLATFORM_NAME.items()
|
||||
v: k for k, v in SLUG_TO_LAUNCHBOX_PLATFORM_NAME.items()
|
||||
}
|
||||
|
||||
@@ -9,11 +9,13 @@ from handler.filesystem import fs_asset_handler, fs_firmware_handler, fs_rom_han
|
||||
from handler.filesystem.roms_handler import FSRom
|
||||
from handler.metadata import (
|
||||
meta_igdb_handler,
|
||||
meta_launchbox_handler,
|
||||
meta_moby_handler,
|
||||
meta_ra_handler,
|
||||
meta_ss_handler,
|
||||
)
|
||||
from handler.metadata.igdb_handler import IGDBPlatform, IGDBRom
|
||||
from handler.metadata.launchbox_handler import LaunchboxPlatform, LaunchboxRom
|
||||
from handler.metadata.moby_handler import MobyGamesPlatform, MobyGamesRom
|
||||
from handler.metadata.ra_handler import RAGameRom, RAGamesPlatform
|
||||
from handler.metadata.ss_handler import SSPlatform, SSRom
|
||||
@@ -43,6 +45,7 @@ class MetadataSource:
|
||||
MOBY = "moby"
|
||||
SS = "ss"
|
||||
RA = "ra"
|
||||
LB = "lb"
|
||||
|
||||
|
||||
async def fetch_ra_info(
|
||||
@@ -144,16 +147,26 @@ async def scan_platform(
|
||||
if MetadataSource.SS in metadata_sources
|
||||
else SSPlatform(ss_id=None, slug=platform_attrs["slug"])
|
||||
)
|
||||
|
||||
ra_platform = (
|
||||
meta_ra_handler.get_platform(platform_attrs["slug"])
|
||||
if MetadataSource.RA in metadata_sources
|
||||
else RAGamesPlatform(ra_id=None, slug=platform_attrs["slug"])
|
||||
)
|
||||
launchbox_platform = (
|
||||
meta_launchbox_handler.get_platform(platform_attrs["slug"])
|
||||
if MetadataSource.LB in metadata_sources
|
||||
else LaunchboxPlatform(slug=platform_attrs["slug"])
|
||||
)
|
||||
|
||||
platform_attrs["name"] = platform_attrs["slug"].replace("-", " ").title()
|
||||
platform_attrs.update(
|
||||
{**ra_platform, **moby_platform, **ss_platform, **igdb_platform}
|
||||
{
|
||||
**launchbox_platform,
|
||||
**ra_platform,
|
||||
**moby_platform,
|
||||
**ss_platform,
|
||||
**igdb_platform,
|
||||
}
|
||||
) # Reverse order
|
||||
|
||||
if (
|
||||
@@ -355,9 +368,22 @@ async def scan_rom(
|
||||
|
||||
return SSRom(ss_id=None)
|
||||
|
||||
async def fetch_launchbox_rom():
|
||||
if MetadataSource.IGDB in metadata_sources and (
|
||||
not rom
|
||||
or scan_type == ScanType.COMPLETE
|
||||
or (scan_type == ScanType.PARTIAL and not rom.launchbox_id)
|
||||
or (scan_type == ScanType.UNIDENTIFIED and not rom.launchbox_id)
|
||||
):
|
||||
return await meta_launchbox_handler.get_rom(rom_attrs["fs_name"])
|
||||
|
||||
return LaunchboxRom(launchbox_id=None)
|
||||
|
||||
# Run both metadata fetches concurrently
|
||||
igdb_handler_rom, moby_handler_rom, ss_handler_rom = await asyncio.gather(
|
||||
fetch_igdb_rom(), fetch_moby_rom(), fetch_ss_rom()
|
||||
igdb_handler_rom, moby_handler_rom, ss_handler_rom, launchbox_handler_rom = (
|
||||
await asyncio.gather(
|
||||
fetch_igdb_rom(), fetch_moby_rom(), fetch_ss_rom(), fetch_launchbox_rom()
|
||||
)
|
||||
)
|
||||
|
||||
if rom:
|
||||
@@ -368,15 +394,25 @@ async def scan_rom(
|
||||
rom_attrs.update({**ss_handler_rom})
|
||||
if igdb_handler_rom.get("igdb_id"):
|
||||
rom_attrs.update({**igdb_handler_rom})
|
||||
if launchbox_handler_rom.get("launchbox_id"):
|
||||
rom_attrs.update({**launchbox_handler_rom})
|
||||
else:
|
||||
# Reversed to prioritize IGDB
|
||||
rom_attrs.update({**moby_handler_rom, **ss_handler_rom, **igdb_handler_rom})
|
||||
rom_attrs.update(
|
||||
{
|
||||
**launchbox_handler_rom,
|
||||
**moby_handler_rom,
|
||||
**ss_handler_rom,
|
||||
**igdb_handler_rom,
|
||||
}
|
||||
)
|
||||
|
||||
# If not found in IGDB, MobyGames and Screenscraper
|
||||
# If not found in any metadata source, we return the rom with the default values
|
||||
if (
|
||||
not igdb_handler_rom.get("igdb_id")
|
||||
and not moby_handler_rom.get("moby_id")
|
||||
and not ss_handler_rom.get("ss_id")
|
||||
and not launchbox_handler_rom.get("launchbox_id")
|
||||
):
|
||||
log.warning(
|
||||
emoji.emojize(f"{hl(rom_attrs['fs_name'])} not identified :cross_mark:"),
|
||||
|
||||
@@ -117,6 +117,7 @@ class Rom(BaseModel):
|
||||
moby_id: Mapped[int | None]
|
||||
ss_id: Mapped[int | None]
|
||||
ra_id: Mapped[int | None]
|
||||
launchbox_id: Mapped[int | None]
|
||||
|
||||
__table_args__ = (
|
||||
Index("idx_roms_igdb_id", "igdb_id"),
|
||||
@@ -124,6 +125,7 @@ class Rom(BaseModel):
|
||||
Index("idx_roms_ss_id", "ss_id"),
|
||||
Index("idx_roms_ra_id", "ra_id"),
|
||||
Index("idx_roms_sgdb_id", "sgdb_id"),
|
||||
Index("idx_roms_launchbox_id", "launchbox_id"),
|
||||
)
|
||||
|
||||
fs_name: Mapped[str] = mapped_column(String(length=450))
|
||||
@@ -147,6 +149,9 @@ class Rom(BaseModel):
|
||||
ra_metadata: Mapped[dict[str, Any] | None] = mapped_column(
|
||||
CustomJSON(), default=dict
|
||||
)
|
||||
launchbox_metadata: Mapped[dict[str, Any] | None] = mapped_column(
|
||||
CustomJSON(), default=dict
|
||||
)
|
||||
|
||||
path_cover_s: Mapped[str | None] = mapped_column(Text, default="")
|
||||
path_cover_l: Mapped[str | None] = mapped_column(Text, default="")
|
||||
|
||||
1
frontend/src/__generated__/index.ts
generated
1
frontend/src/__generated__/index.ts
generated
@@ -6,6 +6,7 @@
|
||||
export type { AddFirmwareResponse } from './models/AddFirmwareResponse';
|
||||
export type { Body_add_collection_api_collections_post } from './models/Body_add_collection_api_collections_post';
|
||||
export type { Body_add_firmware_api_firmware_post } from './models/Body_add_firmware_api_firmware_post';
|
||||
export type { Body_create_user_from_invite_api_users_register_post } from './models/Body_create_user_from_invite_api_users_register_post';
|
||||
export type { Body_request_password_reset_api_forgot_password_post } from './models/Body_request_password_reset_api_forgot_password_post';
|
||||
export type { Body_reset_password_api_reset_password_post } from './models/Body_reset_password_api_reset_password_post';
|
||||
export type { Body_token_api_token_post } from './models/Body_token_api_token_post';
|
||||
|
||||
11
frontend/src/__generated__/models/Body_create_user_from_invite_api_users_register_post.ts
generated
Normal file
11
frontend/src/__generated__/models/Body_create_user_from_invite_api_users_register_post.ts
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
/* generated using openapi-typescript-codegen -- do not edit */
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export type Body_create_user_from_invite_api_users_register_post = {
|
||||
username: string;
|
||||
email: string;
|
||||
password: string;
|
||||
token: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user