* fix(igdb): let region_mode decide the localized title
get_igdb_preferred_locale ignored scan.priority.region_mode, so a rom
tagged (Japan) always got IGDB's ja-JP localized title, even with
prefer_config and us first in scan.priority.region. Under prefer_config
the configured regions now come first and the rom's own tags are the
fallback, matching the ScreenScraper handler since #4413. The default
prefer_rom_tags ordering is unchanged.
Fixes#5784
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(igdb): fold the region_mode note into one docstring sentence
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: code-review
Log a missing IGDB locale at debug: under prefer_config every ROM asks
for the first config locale, so a missing one is routine, not a warning.
Pin SCAN_REGION_MODE in the multi-region locale test instead of relying
on MagicMock's auto attribute.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: simplify
Drop the IGDB-locale filter on the ROM's region codes; the final
lookup loop already skips codes IGDB has no locale for.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: prose
Spell out the USA region in the prefer_config test docstring so it
does not read as the pronoun, untangle the fallback test docstring, and
finish the clipped Returns line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(metadata): share one region order across IGDB, ScreenScraper and LaunchBox
IGDB now tries every preferred locale in order, up to the first region
that uses the default title, instead of only the first. Under
prefer_config with [eu, jp], a (Japan) ROM whose game has no EU
localization gets the Japanese title again rather than the default.
preferred_region_codes in the filesystem base handler builds the region
order once. ScreenScraper, IGDB and LaunchBox all read it, so LaunchBox
artwork follows region_mode too, and uppercase config codes match the
ROM's tags for every provider.
European country codes map to IGDB's EU locale and ScreenScraper's ss
to the default title, so a (France) ROM no longer falls through to the
next configured region.
An unquoted no (Norway, Norwegian) in scan.priority.region or
scan.priority.language loads as false from YAML and crashed every IGDB
match. The config loader now turns it back into "no" and drops other
non-string entries with a warning.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(igdb): drop _string_codes and spell out the EU region codes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
* feat(emulatorjs): expose download cache enable setting
* pr-ready: code-review
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: simplify
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* pr-ready: review-polish
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(config): move cache_limit under emulatorjs.cache and read config.yml strictly
emulatorjs.cache.limit replaces emulatorjs.cache_limit, which is still read
with a deprecation warning and is rewritten to the new key on the next save.
Every config.yml read now goes through one reader that exits with code 3 when
a parent block is not a dictionary (e.g. `netplay: true`), where get_nested
silently fell back to the default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(emulatorjs): clear every EmulatorJS cache and keep nightly's cache size
The clear-cache dialog now also deletes EmulatorJS-bios (4.2.3) and
EmulatorJS-Cache (nightly), which kept serving downloaded files.
Nightly turns EJS_CacheLimit, a per-file byte cap in 4.2.3, into its total
cache size in MB, so a limit under 1 MiB gave a 0 MB cache. Passing
cacheMaxSizeMB explicitly keeps nightly at its own 4096 MB default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(utils): drop get_nested
The config loader reads config.yml through its own strict reader now, so
get_nested has no callers left.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* feat(platforms): split arcade aliases into per-emulator-family slugs
Give MAME, AdvanceMAME, FBNeo, FBA, Daphne, Singe and the arcade boards
that need their own emulator (NAOMI/NAOMI 2/NAOMI GD-ROM, Model 2/3,
Hikaru, Triforce, Lindbergh, Namco System 246/3xx, Gaelco, ...) their own
slugs with verified provider IDs. Providers without a dedicated entry fall
back to their Arcade platform via arcade_fallbacks(). MAME-only boards
(CPS1-3, System 16/32, Model 1, Namco 22) stay aliases of arcade.
Refs #5272
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(platforms): code-review pass on arcade slugs
- Retry IGDB on unmatched scans for every platform IGDB resolves, not
just slugs in IGDB_PLATFORM_LIST.
- Resolve config binding/version values through the alias table, so a
binding to a retired slug (cps2, model1, ...) still lands on a platform.
- Alias the Batocera `typex` folder to type-x.
- Build provider id->slug reverse maps before merging Arcade fallbacks.
- Share one MAME title lookup between base_handler and libretro.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(platforms): simplify pass on arcade slugs
- Alias the three RomM-keyed IGDB versions inside IGDB_PLATFORM_VERSIONS,
dropping IGDB_VERSION_SLUGS and _version_slug.
- Derive EmulatorJS arcade entries from ARCADE_SET_PLATFORMS.
- Remove the unused provider id->slug reverse maps, so the Arcade
fallback merge no longer has an ordering constraint.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* docs(platforms): humanizer pass on arcade slug comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(platforms): settle arcade slug review decisions
- Migration 0154 moves platforms still on a retired MAME-only board slug
(cps1-3, model1, system16, system32, system-32) to arcade, so no row
carries a slug the enum no longer has.
- MAME shortname expansion keys off the RomM slug via
MAME_SHORTNAME_PLATFORMS instead of per-provider arcade ids, so Daphne,
Singe, Type X and Lindbergh sets are no longer read as MAME sets. Neo Geo
now expands at ScreenScraper too, as it already did at IGDB and Moby.
- fba offers fbneo before the FinalBurn Alpha CPS cores.
- AdvanceMAME leaves the WebRcade feed; EmulatorJS and WebRcade share
PLAYABLE_ARCADE_SET_PLATFORMS.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(platforms): code-review pass (xhigh) on arcade slugs
Verify arcade-board BIOS files against the known list's arcade entries,
and make migration 0154 match retired slugs case-insensitively.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(platforms): simplify pass on arcade slugs
Apply IGDB family overrides once in get_platform instead of on each
return path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(platforms): use a slug with no shipped icon
singe now ships an icon, so the no-icon prefetch test needs a slug that never will.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(platforms): add a teknoparrot arcade slug
TeknoParrot runs PC-based arcade boards outside the MAME/FinalBurn family,
so its folder gets its own platform (RetroBat and ES-DE both use
`teknoparrot`). Providers fall back to their Arcade entry, MAME shortname
expansion skips it, and it gets a placeholder icon copied from `arcade`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat(platforms): give each arcade-family icon its own marquee title
Redraws the ARCADE marquee on the copied cabinet icons with each
platform's name, in the Bungee typeface with the original inline and
extrusion styling. Sega boards use Sega blue, Namco systems Namco red,
and Type X Taito blue; the rest keep the original amber.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(platforms): code-review pass (xhigh) on arcade slugs
Neo Geo BIOS lives under arcade in the known BIOS list, so map
neogeoaes and neogeomvs there too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* refactor(platforms): simplify pass on arcade slug tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
* fix(streaming): let a container's broker_secret override STREAMING_BROKER_SECRET
STREAMING_BROKER_SECRET replaced every container's broker_secret, so a pool
of containers with different BROKER_SECRETs could not authenticate: each
broker after the first answered 403 "bad broker secret". A container's own
broker_secret now wins, and the env var is the fallback for containers that
set none. A blank broker_secret also falls back instead of becoming the
literal secret "None".
* test(streaming): cover a blank broker_secret with no env secret
Addresses Greptile review on #5259: the fallback cases all set the env
secret, so none pinned that YAML null no longer becomes the secret "None".
* Update examples/config.example.yml
---------
Co-authored-by: Georges-Antoine Assi <3247106+gantoine@users.noreply.github.com>
* fix(docker): boot when the container runs as a non-default UID
Unraid runs the container as 99:100, which can't write to the image's
/romm (owned by 1000, mode 755), only to the mounted subfolders. The
PSP pending dir at /romm/cache/retroarch_sync was created at import
time, so every gunicorn worker failed to boot.
- Buffer pending PSP save files under the user's assets folder
(assets/users/<user>/retroarch/psp_pending/), beside the other
RetroArch Cloud Sync files and outside the client-reachable blob
categories.
- Move the zip and rom-converto download caches to /tmp/romm/cache,
and point nginx's internal /cache/ alias there.
- Put gunicorn's control socket in /tmp/gunicorn instead of
$HOME/.gunicorn, since HOME is / for that UID.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(docker): honor ROMM_TMP_PATH for caches, explain an unwritable sync folder
- The download caches live under $ROMM_TMP_PATH/cache when it's set,
so installs with a small Docker disk (Unraid's docker.img) can point
them at a share. The entrypoint exports the same path for nginx's
/cache/ alias.
- With ENABLE_SYNC_FOLDER_WATCHER on and /romm/sync not writable, /init
warns and skips the watcher instead of dying on mkdir under errexit.
- The compose example lists the /romm/sync mount the sync features need.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(sync): cover reading back and clearing buffered PSP files
Addresses Greptile's review on #5189.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(sync): apply code-review findings to PSP pending buffer
Remove the emptied psp_pending folder after a merge, define the sync
folder path once in init, update the architecture doc's PSP and blob
locations, and drop a stale .gitignore entry.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(sync): apply simplify findings to PSP pending cleanup
Clear the buffered folder with remove_directory, let the startup check
own creating the sync folder, and reword the test fixture docstring.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(sync): cap buffered PSP files and drop them on delete
Buffered files for an unresolved save folder now count against the
bundle limits, so a folder can't fill the assets share and then fail
every merge once it resolves. A DELETE also removes the buffered copy,
so a deleted file isn't merged back when the folder resolves.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(docker): check the sync folder for push-pull sync too
ENABLE_SYNC_PUSH_PULL keeps SSH keys and device saves under /romm/sync
as well, so an unwritable folder now disables it with the watcher and
warns at boot instead of failing when the task runs.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(docker): strip whitespace from env vars like the backend does
The backend strips every variable it reads, while the init script and
nginx templates used raw values, so a padded ROMM_TMP_PATH sent nginx's
/cache/ alias somewhere the backend never writes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(config): drop the CACHE_BASE_PATH comment
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(docker): say which backend config strips env whitespace
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* revert(docker): drop the entrypoint env whitespace trimming
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(sync): apply pr-ready code-review findings
Gate push-pull on its SSH keys path rather than a writable sync folder,
accept the same truthy values as the backend, and clear only the merged
PSP pending files so another worker's buffered file survives.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor: apply pr-ready simplify findings
Share one truthy pattern across init's flag checks (the watcher gates
now accept the same values as the backend), disable gunicorn's unused
control socket instead of placing it, derive the converts redirect from
its own cache path, and factor the unknown PSP folder in tests.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* docs(docker): apply pr-ready humanizer pass to the sync mount note
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(fs): create handler base folders on first write, skip leftover temp files
FSHandler no longer mkdirs its base path when constructed, so a module-level
handler rooted at an unmounted or unwritable folder can't take down boot;
every write path already creates its parent folders. Blob listings skip
.romm_tmp_ files a crashed write left behind, so they are never merged into
a PSP bundle or advertised in the sync manifest. The prefix now lives in one
TEMP_FILE_PREFIX constant.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(converto): read per-file title ids with rom-converto during scans
The title-id half of #5002: rom-converto's info runs fill rom_files.title_id
and title_version, sigil fills what rom-converto can't read and keeps owning
save targets, and roms in a scan batch share info runs of up to 64 files.
A converto_read_at marker lets quick scans backfill files rom-converto has
not read yet. converto.scan_metadata (config.yml only) turns it off.
The other per-file fields and embedded images stay out until a UI reads them.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): name the same-content check that keeps unread title ids
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): queue unread files in one pass over the built rows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(converto): address Greptile review on #5031
- A file refresh now persists converto_read_at when rom-converto's read
confirms a reused row's stored title id, so the file isn't re-read on
every refresh.
- RomConvertoService.read_infos splits its paths into info runs of at
most INFO_BATCH_SIZE, so a rom with many files can't send them all
through one run.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(converto): apply code-review fixes
- A stored file title id counts as rom-converto's only once rom-converto
has read the row, so a stale sigil id can't override a fresh extraction.
- Fresh hashes decide whether unread title ids still describe a file,
ahead of a size and mtime a copy can preserve.
- One rom's failed candidate listing no longer aborts its scan batch.
- The info paths file's cleanup can't raise out of read_infos.
- _rom_file_order sorts by Path like _TitleIdSource.order.
- Restored the in-place reconcile test for _identify_rom.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): apply simplify pass
- sync_rom_files reads 'rom-converto read this pass' off converto_read_at
instead of an inspected set threaded through ParsedRomFiles, FSRom, the
scan socket and the refresh.
- One _converto_may_read check serves the scan and the batch candidates.
- converto_candidates reuses _list_rom_dir, validates paths off the event
loop and is best-effort itself, so the scan socket gathers it plainly.
- get_rom_files builds rom-converto paths from the validated rom dir
instead of validating each file again.
- _rom_level_identity returns early on sigil's extraction.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(converto): apply review-polish pass
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): drop the shared info batch
Sharing rom-converto info runs across a scan batch saved about 2 ms per
rom (one process start) in exchange for a second directory walk per
rebuilt rom, the RomConvertoInfoBatch bookkeeping and the scan socket
wiring. Each rom now reads its own files; read_infos still caps a run
at INFO_RUN_MAX_FILES.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): name the rom-converto columns inline
Drops ROM_FILE_CONVERTO_COLUMNS and ROM_FILE_CONVERTO_KEPT_COLUMNS, so
_copy_scanned_columns keeps master's frozenset keep_when_unset.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(converto): integrate rom-converto for title id extraction and download conversion
* fix(docker): ship rom-converto in the production image
Only the dev Dockerfile installed the binary, so the integration could
never enable on a released image. Fetch the same pinned, checksummed
musl build in a dedicated stage and copy it next to RAHasher.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(converto): skip the update check and batch info calls
The CLI asks api.github.com for a newer release on every run unless
told not to, so pass --no-update-check on each invocation. Inspect a
rom's files in one `info --paths-file` run instead of one subprocess
per file, and read the inspectable extensions from the capabilities
manifest so scans skip files info cannot recognize.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(scan): keep sigil authoritative for title ids
rom-converto ran first and overrode the ids sigil read. Sigil now runs
first and records its per-file ids; rom-converto only fills files sigil
left unset, on new or changed files, in one batch. Restore the base-id
selection for sigil extractions on every platform, as on master.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(downloads): make conversion opt-in and bound the cache
The download endpoint returned a converted file to every client once a
platform had a target, including the browser player and apps that check
hashes against RomFile. Conversion now needs ?converted=true.
A pre-warmed copy is served whatever its size; the in-request size cap
only gates starting a conversion. ROM_CONVERTO_CACHE_MAX_SIZE_GB
(default 20, 0 unbounded) caps the cache: conversions and the pre-warm
task stop when it is full, and cleanup evicts the least recently served
copies.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(types): regenerate frontend types for the converto schema
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(converto): address code-review findings (pr-ready step 2)
- Fall back to rom-converto's stored ids only when it ran this pass, in
disc order, so a rescan that skipped extraction keeps sigil's save target
- Persist per-file title ids that extraction writes onto reused rows
- Only authenticated callers may start an in-request conversion; past a
240s deadline serve the original and let the conversion finish into the
cache instead of nginx returning 504
- Treat a probe OSError or timeout as a failed probe; kill the subprocess
when the caller is cancelled
- Give the pre-warm task the scan timeout and report progress in the
ConversionStats shape the task UI reads
- Reuse zip_cache constants, walk the cache off the event loop, tolerate
files vanishing mid-cleanup, and trim long comments
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): simplify conversion code (pr-ready step 3)
- Move the converted-download policy (target lookup, cached-first, sync
size cap, deadline) from the endpoint into utils/conversion_cache and
share conversion_target with the pre-warm task
- Share one path lookup between get_cached_converted and get_or_convert;
the pre-warm walks the cache once and tracks a running byte budget
instead of walking it twice per rom
- One normalize_platform_formats beside TARGETS_BY_PLATFORM for the
config loader (via _validated_platform_map) and the settings endpoint;
update_converto_settings takes a ConvertoConfig and is written back
with dataclasses.asdict
- read_infos owns its never-raise contract, so the scan drops its blanket
except; drop the unused RomConvertoInfo.kind and error attributes
- Sort files for the rom-converto identity only when it is used; stat
each cached file once during cleanup
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(converto): trim comments (pr-ready step 4)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): convert on first download instead of pre-warming
A library pre-warm fought the TTL: cleanup dropped every copy nobody
downloaded within a day. Remove the Convert library task and convert on
demand only. Files over ROM_CONVERTO_MAX_SYNC_SIZE_MB now start their
conversion in the background while the original is served, so the next
download within the TTL gets the converted copy at any size.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): drop decrypt and encrypt download targets
Downloads now only change a rom's container or compression (CHD, RVZ,
CSO, NSZ, ...); serving decrypted files is left for a separate decision.
NDS and PS3 have no remaining targets. Also note that the conversion
concurrency limit applies per process.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): move the cache limits into converto.*
cache_max_size_gb and max_sync_size_mb join cache_ttl_hours in
config.yml and PUT /api/config/converto_settings, replacing the
ROM_CONVERTO_CACHE_MAX_SIZE_GB and ROM_CONVERTO_MAX_SYNC_SIZE_MB env
vars, so every eviction knob is edited in one place at runtime. The
loader takes its defaults from ConvertoConfig and one table holds each
integer's minimum for both the loader and the payload.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): lock conversions with flock instead of a sentinel
A conversion now holds a non-blocking flock on its key dir, which the
kernel releases if the worker dies. That replaces the .partial sentinel,
its 6-hour staleness guess (which a long ROM_CONVERTO_TIMEOUT could
outlive), and the rename-aside takeover. Cleanup skips locked dirs, and
partial output gets a hidden name so it never counts as a served copy.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* test(converto): parametrize repeated test cases
Collapse the per-platform info parsing, operation resolution and
converto_active cases into parametrized tests, so a new platform or
target is one row.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(scan): run rom-converto first with sigil as the fallback
rom-converto reads each rom's new or changed files first, in one batch,
and its title ids win. sigil still reads what it can, since it alone
provides save targets and Switch content types, and fills the ids
rom-converto left unset.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* feat(converto): store per-file metadata read by rom-converto during scans
* fix(scan): keep the stored save target when sigil reads nothing
* fix(converto): read Xbox 360 disc ids and Wii title versions, store content type as text
* feat(converto): save file icons, banners and backgrounds read by rom-converto
* chore(converto): bump rom-converto to v0.23.0
* fix(converto): address review findings in the conversion cache, scan metadata and settings
* refactor(converto): move per-file metadata out of the conversion PR
Scan-time metadata (title ids, the 17 rom_files columns, artwork and
converto.scan_metadata) moves to its own PR so its columns land with the
UI that reads them. This PR keeps conversion only.
The conversion cache no longer has uncompressed_size_bytes to budget
with, so a conversion to an uncompressed target reserves a fixed
multiple of its input and the cleanup pass after it evicts any overshoot.
Co-Authored-By: DevYukine <20647088+DevYukine@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017BuuZVVtVPNLRaCjTN9bgQ
* feat(converto): let the client pick the download format with ?format=
`?format=zso,iso` lists the formats a client can read. The stored file is
served whenever its format is listed, even with conversion off, so most
emulator clients never trigger a conversion. Otherwise the first listed
format with a cached copy is served, then the first one rom-converto can
produce.
A conversion that outlasts a short wait answers 202 with Retry-After
instead of falling back to the original, so a URL never serves two
different files and a client never gets bytes it can't read. 406 means
no listed format can be served. HEAD reports the same without starting
a conversion. This replaces `?converted=true`, the per-platform download
target and `max_sync_size_mb`; `cache_ttl_hours` stays config.yml-only.
Co-Authored-By: DevYukine <20647088+DevYukine@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017BuuZVVtVPNLRaCjTN9bgQ
* feat(converto): convert the library in place with a manual task
`converto.platform_formats` now names the format a platform's library is
stored in, and the new "Convert library" task brings every matched rom
to it. Each output is staged in a `.romm_tmp_` directory beside the
original, moved into place, and only then are the originals (and a cue's
tracks) deleted. Single-file roms take the new name, folder roms keep
theirs and get their .m3u entries rewritten, and the file rows refresh,
so a rom keeps its id, saves and collections.
Only lossless conversions qualify, so xbox (xiso trims the dump) has no
library format. Unmatched roms are skipped because a converted file no
longer hash-matches a DAT. `/api/config` now carries the library targets
and, per input extension, the formats a download can be converted to.
Co-Authored-By: DevYukine <20647088+DevYukine@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017BuuZVVtVPNLRaCjTN9bgQ
* fix(converto): address Greptile and Copilot review findings
- Publish a converted library file with a no-replace link, so a file that
appears during conversion is never overwritten.
- Delete originals only after the rom row or its playlists point at the new
file, and keep them if that update fails. Playlists are rewritten atomically.
- Refuse a cue conversion whose tracks another rom or another cue holds.
- Remove stage dirs a killed conversion left behind.
- Try later ?format= targets when a conversion fails, treat any locked key dir
as converting, and cap how many conversions downloads can start.
- Drop the unsupported iso target for CD platforms from the example config and
list the ROM_CONVERTO_* variables in env.template.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* fix(converto): address code-review findings (pr-ready step 2)
Serve converted outputs at 0644, read cue sheets and playlists with a BOM,
stage folder rom conversions outside the rom folder, keep one rom's failure
from stopping the convert library task, accept alias extensions as the stored
format, probe running conversions with a shared lock, and bound the timeout.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): simplify conversion code (pr-ready step 3)
Check and chmod rom-converto output once in the adapter, canonicalize
requested format aliases, reuse LINK_FALLBACK_ERRNOS and the handler's atomic
write, make the download format table a constant, skip the probe lock once
cached, and fold duplicated name checks and cache stat passes.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* chore(converto): trim comments (pr-ready step 4)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
* refactor(converto): find rom-converto on PATH instead of ROM_CONVERTO_PATH
Both images install the binary on PATH, the variable was undocumented,
and RAHasher is already resolved the same way.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Yukine <devyukine@gmx.de>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: DevYukine <20647088+DevYukine@users.noreply.github.com>
The streaming response models were the only ones using attribute docstrings; they are now # comments above each field like the rest of endpoints/responses. Pydantic never read them (use_attribute_docstrings is unset), so the OpenAPI schema is unchanged.
A webstation container that mounts the library at /romm/library, like RomM,
needs no library_path, so the example comments it out and says when to set
it. The dev compose comment now says why the host-run dev backend still
needs it.
AssetList moved its timestamp into <AssetTimestamp> and gained
groupBySlot on master, so the picker's `timestamp` prop now feeds the
component's date and both props coexist. The "updated" | "created" type
and its accessor join Asset's other shared helpers in v2/utils/assets,
where AssetPreview takes them too, since the old local name collided
with the AssetTimestamp component.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The periodic save upload only ran on EmulatorJS' "System Save interval"
tick (5 minutes by default, never when the player disabled it), and was
off unless emulatorjs.auto_save_sync was set. The player now flushes the
SRAM itself every 5 seconds while the game runs, so the existing tracker
sees a new in-game save on the next two agreeing ticks and uploads it,
and the config flag defaults to on.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MozJiij1oQbu12GvtAPBFR
The save picker was gated on a hardcoded set of emulators mirroring the
webstation broker's `clears_stale_saves`, a value that lives in another
repo. A broker release that turns it on for a new emulator needed a RomM
code change before the picker appeared, and an operator on a fork or a
newer broker could not turn it on at all. The other direction was worse
because it was silent: if the broker stopped clearing, the pick still
validated, the archive still uploaded, and the container's own newer
files overwrote it with no error anywhere.
`clears_stale_saves` now joins `memory_card_sync` in
PLATFORM_OVERRIDE_KEYS, resolved per container in `_resolve_one`, which
leaves the emulator table as the default rather than the authority. It
also joins the pool-interchangeability check, since the picker is
advertised from the head of the pool and a member that keeps its own
files would take the pick and discard it.
The cover search dialog only reached SteamGridDB, so a PC game whose
capsule lives on Steam had no way to pick it up short of a full
re-match. Steam now joins SteamGridDB behind `GET /search/cover`,
ordered by the configured cover priority, and each result carries its
provider so the dialog can filter by source and credit the artwork.
The Steam handler builds the picker from the store search alone and
probes the CDN for the portrait capsule and the landscape header under
the same budget the match picker uses, so a slow CDN costs thumbnails
rather than the dialog. Hits with no artwork are dropped.
A failing provider costs only its own covers; a rejected SteamGridDB
key is still reported, since that is the user's to fix. The "search
cover" action in the edit dialog now opens whenever either provider is
enabled, and the game overview credits Steam-hosted covers.
The resource shape the picker consumes moves to the shared base handler
as `CoverResource` / `CoverResult`, since it is no longer SteamGridDB's
alone.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Untv32z88QMZ2yRSsTgGcC
Drop the console.warn for an unsupported configured core: it re-derived
the check the resolver already makes, and fired on the player's device
rather than where the admin would see it. The example config now points
at the exact core name instead.
Hoist the platform slug in onMounted, name the comment's dependency
rather than its placement, drop a redundant optional chain, and put the
new config tests on a helper matching their neighbours.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add an `emulatorjs.default_cores` block mapping a platform slug to the
core the player preselects for it, so an instance can run DS software on
DeSmuME and DSi software on melonDS without every user picking a core on
every device.
The player resolves its core from the game's remembered core, then the
platform's, then the configured default, then the platform's first
supported core. Each candidate is checked against the cores the platform
actually supports, so an unknown platform or core falls through.
Playing no longer writes the resolved core back to local storage unless
the user picked a different one, so changing the configured default
reaches devices that never made a choice.
Closes#4434
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The docs link carries the grammar and the examples demonstrate it, so the prose
restating both goes. Thirteen comment lines become four.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`filesystem.structure` now spells out the whole layout rather than only the part
below a platform folder. A template is relative to the library root, `{platform}`
marks the platform folder, and `{game}` marks where a game begins.
Merge `{gameFile}` and `{gameDir}` into one `{game}` terminal. The information a
terminal carried was the depth, not the kind: at a declared level a file is a
game of its own and a folder is one multi-file game, which a stat answers. That
drops the two-template idiom for a level holding both, and `_discover_default_roms`
with it, since the default scan is now just `roms/{platform}/{game}`.
Retire the auto-detected `{platform}/roms` layout, along with
`filesystem.roms_folder` and `filesystem.firmware_folder`, which named one path
segment each that a template now contains. Both are refused at startup with the
template that reproduces the layout, so an instance that relied on either says so
instead of scanning an empty library and marking every rom missing. Firmware gets
its own `structure.firmware` key rather than following the rom layout implicitly.
`get_roms_fs_structure` keeps meaning the folder a platform's games start in, so
the `.physical` sentinel paths already in the database still resolve. Per-platform
overrides have to agree with `default` on where the platform folder sits;
relocating one platform needs platform discovery and the watcher to union several
roots, which is left out.
The setup wizard reports `library_ready` plus the configured template instead of
a `struct_a`/`struct_b` discriminator, so the banner shows the layout in force
rather than guessing it client-side.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The comment block explaining `filesystem.structure` had grown to 45 lines of
prose in an example config. Keep the syntax essentials and the examples, and
point at the docs page for the rest.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A grouping folder is no longer also a game. With `{gameDir}` and
`{category}/{gameFile}` declared together, the category folder was surfaced
as a multi-file game *and* descended into, listing its contents twice. A
folder any template descends into is now treated as a grouping level.
Relocation runs for every platform, not only those with a custom structure.
Dropping a platform's template moves every game back to the platform root,
which previously read as a library of new games and orphaned all the saves,
play history, favorites and collection membership. A library whose paths are
unchanged still costs one query and no hashing. This also removes the need
for a manual "apply relocation" toggle.
Physical games are excluded from relocation candidates: they have no file, so
they read as having disappeared from their path on every scan.
A near-miss on the terminal macro (`{gameFolder}` for `{gameDir}`) now names
the offending section instead of only reporting a missing terminal.
Documents two limits the QA pass asked about: a move that also compresses or
extracts the game changes its size and is not detected (the size pre-filter
runs before hashing), and how reverting to the default layout behaves.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Conflict resolution notes:
- Locale rom.json: master sorted and reworked every file; took master's and
re-inserted `location` / `location-copied` in sorted position. Added them to
the new tr_TR locale.
- FSRom gained a required `fs_path`, so `build_hashless_fs_rom` now takes one
and both call sites pass the rom's own path.
- `get_roms` keeps this branch's `_collect_fs_roms` discovery while adopting
master's one-pass build and in-place sort.
- `mark_missing_roms` takes full paths and now also excludes physical games
(master), and the scan loop keeps master's early missing-sync plus its
restored-rom emit alongside this branch's relocation pass. The relocation
filter now applies only to the identify loop, so a relocated rom is no longer
re-flagged missing at the end of the scan.
- Relocation writes rom files through master's `sync_rom_files` (which replaced
`purge_rom_files` / `add_rom_file`), so row ids and track metadata survive.
- Master's unique index on (platform_id, fs_name) contradicts this branch's
premise that same-named files in different folders are distinct games.
Migration 0126 widens it to (platform_id, fs_path, fs_name); physical games
all share one folder, so a duplicate title is still rejected.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Hashing 1.96 GiB of real ROM files is 2.2x faster at 4 concurrent
workers than at 1 (108 -> 240 MiB/s on 16 cores, 108 -> 264 MiB/s
pinned to 4 cores). Pinned to 2 cores it is still 1.6x, so the new
default costs nothing on small hosts.
Metadata providers cap themselves independently of this value, so the
extra workers queue rather than exceed an allowance: ScreenScraper holds
a concurrency limiter set to the account's advertised thread count, and
the other adapters pace their own request rate. Database work in the
scan path is synchronous on the event loop, so it serializes regardless
and the connection pool is unaffected.
The compose example advised one worker per CPU, which overshoots on a
large host. Both it and env.template now say what raising this actually
buys, since metadata is paced no matter how many workers there are.
Only installs that never set SCAN_WORKERS move; any explicit value is
preserved.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
"2 x CPU cores + 1" is gunicorn's guidance for sync workers. RomM runs
UvicornWorker with sync endpoints served from Starlette's threadpool, so
the rule does not transfer: on a 16-core host it measured 3x slower than
4 workers and cost 5.31 GB PSS.
The variable also only reaches the gunicorn API server; background tasks
run in the separate RQ worker processes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Change detection needs equality, not a fingerprint, and the hash was the
only reason the tick handler was async. Comparing bytes drops the WebCrypto
call, its non-secure-context fallback, and both mid-flight liveness checks
the awaits had made necessary: the decision now runs before the upload with
nothing suspended in between.
Seeding reads the SRAM with getSaveFile(false), which skips the dump that
was firing a saveSaveFiles tick, so the subscription no longer has to be
ordered below it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The active flag and the install slot both said "this component still owns
the subscription", so the slot alone now carries it.
fnv1a64's second lane re-hashed the same bytes offset by one with the same
prime, leaving the halves correlated; distinct primes over a single load
drop the per-byte modulo too.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Behind a new config flag, emulatorjs.auto_save_sync (default false), the
EmulatorJS player uploads the in-game save (.srm) to the server on
EmulatorJS' own "System Save interval" tick, without Save & Quit.
EmulatorJS already runs that timer (default 300 s) and its
gameManager.saveSaveFiles() fires a "saveSaveFiles" event carrying the
SRAM bytes, but nothing listens to it, so today an in-game save reaches
the server only from Save & Quit or the Export Save File button (#4201).
This subscribes to that event from Player.vue and uploads through the
existing saveSave() when the SRAM hash is unchanged since the previous
tick (a save the core is still writing is never uploaded — the corruption
the earlier automatic upload was removed for, #2349) and differs from the
last upload (an idle session uploads nothing). The tracker is seeded from
the SRAM the core holds after the server save is applied, so a launch
never uploads the server's own file back, and the subscription is turned
off before Save & Quit, Quit and unmount.
The bytes EmulatorJS hands out are views onto the emulator heap, a
SharedArrayBuffer on threaded cores; they are copied into a plain
ArrayBuffer before hashing or uploading.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Both exporters rebuilt their file from the database on every run, so a
scan with `scan.gamelist.export: true` threw away everything the frontend
or the user had written into it: favorites, play counts, per-game
emulator and core overrides, hashes, `<folder>` entries, ES-DE's
`<alternativeEmulator>` block, and Pegasus launch commands.
The exporters now read the existing file first and merge into it. For a
ROM RomM knows, the tags and keys RomM emits replace the old ones and
everything else is carried over. Entries with no matching ROM, folders,
scraper provider blocks and later Pegasus collections are written back
untouched. A file that cannot be parsed or decoded is left alone and the
export for that platform fails instead of replacing it.
Fixes#4158
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XjH6MYLVFVoY92JdBFgKXw
Conflicts and how they were resolved:
- `useGameActions`: master renamed `useCanPlay`'s `canPlay` to `canPlayLocal`
and kept a local `canPlayStream`, while this branch moved `canPlayStream`
into `useCanPlay` and folded it into `canPlay`. Kept this branch's shape and
took master's `useScanTrigger()` call.
- `Player/Stream.vue`: kept this branch's force-release and session-poll block,
and re-placed master's `useUnloadGuard(sessionActive)` next to the
`sessionActive` watch.
- `locales/*/play.json`: kept both sides' keys, re-sorted.
- `__generated__/index.ts`: kept both sides' model exports, re-sorted.
- `test_config_loader.py`: kept both sides' tests.
Master took 0114 through 0118 while this branch was open, so its three
migrations are renumbered 0119-0121 and rechained after
`0118_rom_category_cheat_pg`, leaving alembic with a single head.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Fold the folder name resolution into one home and make it case-insensitive
end to end.
Config folder names are lowercased as the config is parsed, so bindings,
versions and the built-in alias table are all matched the same way. A SNES/
folder now resolves, and a binding written GameCube: matches a gamecube/
folder.
Add resolve_fs_slug(), the inverse used to recover a renamed folder, which
replaces the two swapped dicts in scan_platform. Only slugs reached by
exactly one folder name are reversible, so recovery never guesses between
amiga500, amiga600 and amiga1200.
Validate system.platforms and system.versions through one helper that
rejects empty and non-string values, and treat a null block as empty rather
than exiting.
Restore the atari800 override in the example configs: its folder name is
itself a RomM slug, so it can never be an alias. A new test derives the
needed overrides from the alias table to keep the examples honest.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Frontend system folders such as gamecube, megadrive or n3ds only became
RomM platforms after the user copied a 100+ line system.platforms map into
config.yml. A built-in alias table now covers the folder names those
frontends use, seeded from the two example configs and cross-checked
against the upstream system lists.
Resolution order is unchanged for existing users: config bindings and
versions win, a folder name that already is a slug keeps matching itself,
and only then is the alias table consulted. The two call sites that
resolved folder names by hand share one resolver.
The example configs shrink to genuine overrides. The Batocera example
also mapped odyssey2 to the original Odyssey; the alias points at
Odyssey 2.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Extends the streaming container config so one container can serve many
platforms, adds the webstation protocol and subfolder keys, and warns
when a config still uses the deprecated per-emulator broker mods.
Also pins DB_NAME to a dedicated test database so the autouse
clear_database fixture can never wipe a real dev database.
Quality pass over the title id feature, no behaviour change.
Give the Switch platform family one home by deriving it from the sigil
slug map, and drop the two inline tuples and the local frozenset that
restated it. Express the base-title-id rule once: a base id is its own
derived base. Compose the bracket regex from the 16-hex pattern instead
of repeating it.
Return the embedded name from the extraction closure rather than writing
it through nonlocal, which removes the is_rom_level flag and the repeated
sigil_platform guards, and factor the twice-duplicated rom-level file
tail into one helper.
Cut two per-ROM costs in _identify_rom: config.yml was re-read and
re-parsed three times per ROM, and the prod.keys firmware lookup ran one
DB query per Switch ROM despite depending only on the platform. Both are
now resolved once, the latter in the per-platform callers.
Also document skip_title_id_extraction and embed_switch_title_ids, drop
the always-dashed title/save id rows from the metadata tab, and render
the file row's chips from one list.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Steam covers the PC platforms RomM otherwise has thin metadata for, and
its store payload is provider-grade on its own: title, description,
portrait capsule art, screenshots, genres, developers, publishers,
release date and Metacritic score, with no API key.
Valve documents no storefront API, so this reads the two endpoints that
back the store's own search box and app pages, paced well under the ~200
requests per 5 minutes they tolerate. Every failure path degrades to "no
match" rather than aborting a scan, and the provider is opt-in behind
STEAM_API_ENABLED, matching HowLongToBeat and Flashpoint.
Matching is gated on the platform slug so the three PC platforms are the
only ones that spend a request. The storefront's search index carries
DLC, soundtracks and tools alongside games, so hits are filtered by type
and then confirmed against the app page, which is the only place a demo
or a video is distinguishable from a game. A (steam-12345) filename tag
pins a match by hand when the title is ambiguous.
SteamMetadata reuses the key names the other providers already use for
the values they share, so wiring Steam into the generated facet columns
later is a SQL change with no stored-row reshaping.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The Batocera example bound the tic80 folder to "tic", which is not a
platform slug RomM knows. A binding to an unknown slug still applies, so
the platform is created with that slug, matches no metadata provider, and
is named from the string itself rather than being identified.
The real slug is tic-80.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ScreenScraper scraping added the fanart and title-screen URLs to
url_screenshots even though the same images are persisted to their
dedicated fanart/ and title_screen/ media folders, downloading and
storing every image twice. Restrict url_screenshots to the actual
screenshot media type; the dedicated media still renders in the artwork
gallery. The gamelist handler had the same pattern with title_screen
and gets the same fix.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
New opt-in config key scan.priority.region_mode with values
prefer_rom_tags (default, current behavior) and prefer_config. With
prefer_config, the configured region priority outranks the rom's
filename region tags when selecting ScreenScraper media, and the rom's
own tags remain the fallback when the configured regions have no media.
Unknown values warn and fall back to prefer_rom_tags, and the key
survives runtime config-file rewrites.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>