add to example config

This commit is contained in:
Georges-Antoine Assi
2025-09-21 19:23:20 -04:00
parent 4a8ddd7b22
commit b3a1b6a361
7 changed files with 91 additions and 34 deletions

View File

@@ -385,6 +385,8 @@ class DBRomsHandler(DBBaseHandler):
user_id: int | None = None,
session: Session = None,
) -> Query[Rom]:
from handler.scan_handler import MetadataSource
if platform_id:
query = self.filter_by_platform_id(query, platform_id)
@@ -467,46 +469,50 @@ class DBRomsHandler(DBBaseHandler):
.over(
partition_by=func.coalesce(
_create_metadata_id_case(
"igdb",
MetadataSource.IGDB,
base_subquery.c.igdb_id,
base_subquery.c.platform_id,
),
_create_metadata_id_case(
"ss", base_subquery.c.ss_id, base_subquery.c.platform_id
MetadataSource.SS,
base_subquery.c.ss_id,
base_subquery.c.platform_id,
),
_create_metadata_id_case(
"moby",
MetadataSource.MOBY,
base_subquery.c.moby_id,
base_subquery.c.platform_id,
),
_create_metadata_id_case(
"ra", base_subquery.c.ra_id, base_subquery.c.platform_id
MetadataSource.RA,
base_subquery.c.ra_id,
base_subquery.c.platform_id,
),
_create_metadata_id_case(
"hasheous",
MetadataSource.HASHEOUS,
base_subquery.c.hasheous_id,
base_subquery.c.platform_id,
),
_create_metadata_id_case(
"launchbox",
MetadataSource.LB,
base_subquery.c.launchbox_id,
base_subquery.c.platform_id,
),
_create_metadata_id_case(
"tgdb",
MetadataSource.TGDB,
base_subquery.c.tgdb_id,
base_subquery.c.platform_id,
),
_create_metadata_id_case(
"romm-",
base_subquery.c.platform_id,
base_subquery.c.id,
),
_create_metadata_id_case(
"flashpoint",
MetadataSource.FLASHPOINT,
base_subquery.c.flashpoint_id,
base_subquery.c.platform_id,
),
_create_metadata_id_case(
"romm",
base_subquery.c.platform_id,
base_subquery.c.id,
),
),
order_by=[
is_main_sibling_order,

View File

@@ -177,14 +177,18 @@ def build_ss_rom(game: SSGame) -> SSRom:
if res_name:
break
res_summary = next(
(
synopsis["text"]
for synopsis in game.get("synopsis", [])
if synopsis.get("langue") == "en"
),
"",
)
res_summary = ""
for lang in get_preferred_languages():
res_summary = next(
(
synopsis["text"]
for synopsis in game.get("synopsis", [])
if synopsis.get("langue") == lang
),
"",
)
if res_summary:
break
url_cover = ""
for region in get_preferred_regions():

View File

@@ -103,15 +103,12 @@ def get_priority_ordered_metadata_sources(
else:
priority_order = cnfg.SCAN_ARTWORK_PRIORITY
print(f"priority_order: {priority_order}")
# Filter priority order to only include sources that are available
ordered_sources = [
MetadataSource(source)
for source in priority_order
if source in metadata_sources
]
print(f"ordered_sources: {ordered_sources}")
# Add any remaining sources that weren't in the priority list
remaining_sources = [
@@ -119,7 +116,6 @@ def get_priority_ordered_metadata_sources(
for source in metadata_sources
if source not in ordered_sources
]
print(f"remaining_sources: {remaining_sources}")
return ordered_sources + remaining_sources
@@ -634,13 +630,10 @@ async def scan_rom(
available_sources = [
name for name, handler in metadata_handlers.items() if handler.get(f"{name}_id")
]
print(f"available_sources: {available_sources}")
priority_ordered = get_priority_ordered_metadata_sources(
available_sources, "metadata"
)
print(f"priority_ordered: {priority_ordered}")
for source_name in reversed(priority_ordered):
print(f"applying: {source_name}")
rom_attrs.update({**metadata_handlers[source_name]})
# Get artwork sources and apply in reverse priority order (highest priority last)

View File

@@ -30,6 +30,22 @@ filesystem:
roms_folder: "ROMS"
firmware_folder: "BIOS"
scan:
priority:
metadata:
- "ss" # Screenscraper
- "lb" # Launchbox
artwork:
- "igdb" # IGDB
- "ss" # Screenscraper
region:
- jp
- eu
- wor
language:
- jp
- es
emulatorjs:
debug: true
cache_limit: 1000

View File

@@ -33,6 +33,10 @@ def test_config_loader():
"_3": {},
},
}
assert loader.config.SCAN_METADATA_PRIORITY == ["ss", "lb"]
assert loader.config.SCAN_ARTWORK_PRIORITY == ["igdb", "ss"]
assert loader.config.SCAN_REGION_PRIORITY == ["jp", "eu", "wor"]
assert loader.config.SCAN_LANGUAGE_PRIORITY == ["jp", "es"]
def test_empty_config_loader():

View File

@@ -47,6 +47,38 @@ system:
# The folder name where your roms are located
filesystem: {} # { roms_folder: 'roms' } For example if your folder structure is /home/user/library/roms_folder
# Metadata priority during scans
# Below are the default priority values used
# scan:
# priority:
# metadata: # Top-level metadata source priority
# - "igdb" # IGDB
# - "moby" # MobyGames
# - "ss" # Screenscraper
# - "ra" # RetroAchivements
# - "lb" # Launchbox
# - "hasheous" # Hasheous
# - "flashpoint" # Flashpoint Project
# - "hltb" # HowLongToBeat
# artwork: # Cover art and screenshots
# - "igdb" # IGDB
# - "moby" # MobyGames
# - "ss" # Screenscraper
# - "ra" # RetroAchivements
# - "lb" # Launchbox
# - "hasheous" # Hasheous
# - "flashpoint" # Flashpoint Project
# - "hltb" # HowLongToBeat
# region: # Cover art and game title (only used by Screenscraper)
# - "us"
# - "wor"
# - "ss"
# - "eu"
# - "jp"
# language: # Cover art and game title (only used by Screenscraper)
# - "en"
# - "fr"
# EmulatorJS per-core options
# emulatorjs:
# debug: true # Available options will be logged to the browser console

View File

@@ -89,13 +89,15 @@ const coverImageSource = computed(() => {
try {
const hostname = new URL(props.rom.url_cover).hostname;
if (hostname.includes("images.igdb.com")) return "IGDB";
if (hostname.includes("igdb.com")) return "IGDB";
if (hostname.includes("screenscraper.fr")) return "ScreenScraper";
if (hostname.includes("cdn.mobygames.com")) return "MobyGames";
if (hostname.includes("images.launchbox-app.com")) return "LaunchBox";
if (hostname.includes("media.retroachievements.org"))
return "RetroAchievements";
if (hostname.includes("cdn2.steamgriddb.com")) return "SteamGridDB";
if (hostname.includes("mobygames.com")) return "MobyGames";
if (hostname.includes("retroachievements.org")) return "RetroAchievements";
if (hostname.includes("launchbox-app.com")) return "LaunchBox";
if (hostname.includes("steamgriddb.com")) return "SteamGridDB";
if (hostname.includes("hasheous.org")) return "Hasheous";
if (hostname.includes("infinity.unstable.life")) return "Flashpoint";
if (hostname.includes("howlongtobeat.com")) return "HowLongToBeat";
return null;
} catch {