Commit Graph

9 Commits

Author SHA1 Message Date
Georges-Antoine Assi
ea44dfd9cf refactor(metadata): fold the index follows into one lookup each
The title index reader now takes the key and field it reads, so the two
call sites lose their intermediate hit variable, and the alternate name
path follows its id through `get_by_id` like the other two. The Switch
titleID read is shared between the two lookups that do it.

The LaunchBox import reads the `Game` fields with `findtext`, and the
Switch import queues both indexes from one pass over the batches. The
image projection moves next to the `LaunchboxImage` type it fills.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-10 13:17:44 -04:00
Georges-Antoine Assi
d4f3d8be83 perf(metadata): stop storing the metadata dumps twice over in the cache
The LaunchBox import wrote the whole game record into three hashes: once
under its database id, and again under its title and folded title. The
Switch TitleDB import wrote every entry twice, once per id it is looked up
by. Both title indexes and the product id index now hold the id of the
record they point at, and the reader follows it.

Image lists also carried a `DatabaseID` repeating the field they are stored
under, plus a `CRC32` no lookup reads.

Measured on a full import of both dumps into the bundled valkey:
941MB -> 466MB of `used_memory`.

An index written by an earlier import still holds whole records, so a
lookup keeps answering off it until the next update rewrites the store.

Fixes #4395

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 20:25:42 -04:00
Sam Dornan
6ce0a2f528 fix(launchbox): match titles differing only by punctuation
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>
2026-08-17 16:51:42 -05:00
Sam Dornan
94f6b16ec1 fix(launchbox): match dump filenames against the metadata store
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>
2026-08-06 12:50:24 -05:00
Georges-Antoine Assi
52940ea3d4 fix(launchbox): stop the cloud provider from silently matching nothing
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>
2026-07-28 19:55:16 -04:00
Georges-Antoine Assi
90945685e4 Stuff 2026-05-17 12:43:33 -04:00
Georges-Antoine Assi
fad2e5c77d Use correct LaunchBox MameFile schema
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>
2026-04-18 14:31:16 -04:00
Georges-Antoine Assi
a83f3bdca7 Wire up LaunchBox MAME arcade lookups
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>
2026-04-18 12:00:26 -04:00
Georges-Antoine Assi
eda88b70d1 get claude to refactor launchbox_handler 2026-03-07 16:02:39 -05:00