The LaunchBox name lookup rewrites a search term before hitting the
metadata index: " - " becomes ": ", and a trailing article is moved back
to the front. Both rewrites are anchored on literal spaces, so a dump
named with underscores reaches neither, and the folded fallback cannot
recover it either because the article is left in the wrong position.
Legend_of_Zelda,_The_-_A_Link_to_the_Past.smc missed every index stage
while its space-separated equivalent matched. Swap underscores for
spaces before the rewrites so both forms resolve to the same term.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A mark was dropped whenever it was not alphanumeric, and the accent strip
before it removed every mark carrying a combining class. Between them they
took the vowel signs and viramas Indic and Thai scripts spell with, so
"हिन्दी गेम" folded to "हनदगम" and titles differing only in those marks
collided.
A mark now only goes when it sits on a Latin letter, which is the case it
was meant for. Collisions across the dump are unchanged at 551 of 186505
keys, none differing in their digits, and the PlayStation 2 gain still
measures 96.7%.
Also build each game's dict once rather than per index write.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Folding to ASCII alone reduced a title written in another script to
whatever digits it carried, so "三國立志傳2" and "忍者村大战2" shared one key
and four Windows titles collapsed onto "2". Keeping every alphanumeric
character instead separates them and gives the 208 titles that folded to
nothing a key of their own.
Measured over all 187067 named games in the dump, colliding folded keys
drop from 597 to 551 and the PlayStation 2 gain is unchanged at 96.7%.
Every surviving collision is a punctuation variant of one game, and none
differ in their digits, so no entry in a series folds onto another.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
LaunchBox titles carry colons, diacritics and characters a filesystem
forbids that a ROM filename cannot, so an exact-key lookup misses games
the dump holds: "Burnout Revenge" against "Burnout: Revenge", "Asterix"
against "Astérix", "AC-DC" against "AC/DC".
Index every title under a folded form as well, and consult it only once
every exact form has missed so an exact hit still wins.
Measured over the 2585 Redump-style PlayStation 2 titles the dump names,
this lifts matching from 89.8% to 96.7%. All five colliding folded keys
are LaunchBox's own duplicate records for a single game.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
LaunchBox lookups are exact key reads, so a filename that doesn't already
read like a LaunchBox title misses. Three gaps closed:
- No-Intro inverts leading articles ("Legend of Zelda, The - Ocarina of
Time"), LaunchBox keeps them in front, so the de-inverted form is now
tried against the name and alternate-name indexes as well. Measured over
the No-Intro sets: N64 unmatched 200 -> 171, SNES 461 -> 318, Genesis
285 -> 191, GBA 683 -> 576.
- Files.xml, a filename-to-title index the dump already ships and the
update task already caches, was never read by any lookup. It now runs
ahead of the name search, which is the only route to titles whose files
are named nothing like them (MS-DOS, Amiga, Arcade). Its cache key gains
the platform, since the same dump filename exists on several systems.
- A local LaunchBox install was only reachable by an exact filename,
extension included, or by a stem equal to the title. A library of `.zip`
archives could never match an install pointing at `.z64`, and a No-Intro
stem still carries region tags. Both sides now reduce to shared forms.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The store is written in batches, so an initial import answers for the
names committed so far long before it holds the whole dump. Checking
that the name index exists reported the provider healthy off a fraction
of the entries, and a run that died partway left it that way for good.
Flag the initial import and clear it once a run completes, so only a
finished import counts as healthy. A refresh keeps serving the previous
dump, so it is not flagged.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
LaunchBox cloud lookups read from a Redis store that only the metadata
update task fills, but nothing surfaced when that store was empty. The
provider reported healthy, every search returned zero results, and the
logs said nothing.
- heartbeat now reports unhealthy until the store is populated, and an
empty store logs what to set to fix it
- the update task can be run manually whenever LAUNCHBOX_API_ENABLED is
on, instead of also requiring the scheduled-update flag
- the ~600k entry dump was buffered into a single pipeline, peaking at
1.7GB of RSS and writing nothing at all if the job was killed part way
through. Writes now go out in batches and parsed elements are dropped
as they are consumed, which caps the run at ~260MB. The task also gets
its own timeout, since the default 5 minutes does not cover a 100MB
download plus a 500MB parse
- alternate name lookups ignored the platform, so "Super Mario World" on
PlayStation matched Super Mario Bros.
- Coleco ADAM was spelled wrong, and Famicom / Super Famicom pointed at
platform names LaunchBox does not use
Fixes#3981
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
LaunchBox remote covers were selected by image type only, picking the
first image of the best type regardless of region. A ROM tagged "(USA)"
could get a Europe box even when a North America box existed.
Derive the ROM's preferred region shortcodes from its filename, map
LaunchBox region names ("North America" -> "us") to the same shortcodes,
and use region as a tiebreaker within the winning cover type.
Fixes#3706
Generated-By: PostHog Code
Task-Id: 1e53a6d4-2d71-413d-8b2a-aa94b01b7e63
UPDATE scans with a known launchbox_id were calling get_rom_by_id(),
which only returns remote data and bypassed get_rom()'s local-first
merge — so local-only fields like Notes were getting clobbered and
local media matching fidelity dropped. get_rom_by_id() now optionally
takes fs_name/platform_slug and merges the local entry when its
DatabaseID matches the requested id.
Also fixes populate_rom_specific_paths writing every video as
video.mp4 regardless of source extension; since store_media_file is a
byte copy, .mkv/.webm contents would be served as .mp4 and break MIME
sniffing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The sample_metadata.zip test fixture used invented tag names
(<Description>, FileName ending in .zip). Real LaunchBox Mame.xml
(see backend/tasks/fixtures/launchbox/mame.xml) uses <Name> as the
full title and keys MameFile entries by the stem (e.g. wrlok_l3),
no extension. Read Name instead of Description, and fall back to
the stem when the raw fs_name lookup misses.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
remote_media_req built a MediaRequest with platform_name=None, which
made _build_local_media_context bail and never search on-disk
Images/Manuals/Videos. Any rom that matched only via Metadata.xml (no
local XML entry) ended up with images: [] even though LaunchBox art
was sitting on disk. Thread platform_name and fs_name into
remote_media_req, falling back to the remote entry's Platform field
when no slug is available (e.g. lookups by database id).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
LaunchBox stores videos under /romm/launchbox/Videos/<Platform>/<Game>.<ext>
but the handler only extracted YouTube IDs; LAUNCHBOX_VIDEOS_DIR was
defined and unused. Add _get_video() to surface local videos as
launchbox-file:// URLs, thread a populate_rom_specific_paths() through
the scan pipeline to set video_path once the rom is known, and mirror
the SS/gamelist branch in the scan socket so store_media_file actually
copies the video into the rom's resource directory. Rom.path_video now
also reads from launchbox_metadata.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The scheduled task populated LAUNCHBOX_MAME_KEY from Mame.xml but no
handler code ever read it, so arcade ROMs like pacman.zip never matched
against Metadata.xml (which keys on full titles like "Pac-Man"). Add
RemoteSource.get_mame_entry() and an ARCADE branch in get_rom() that
resolves the MAME filename to its Description before name lookup.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>