fix(launchbox): import local media when matching via update_rom#3687
Merged
Conversation
Manually (re)matching a LaunchBox ID through the ROM edit dialog never imported any LaunchBox media. The update_rom endpoint fetched metadata without fs_name/platform_slug (so local media never resolved), never generated media paths, and had no store loop, unlike the ScreenScraper block in the same handler. Pass fs_name/platform_slug to get_rom_by_id, call populate_rom_specific_paths on the fetched metadata, and add a store_media_file loop that also clears stale media when the ID changes. Fixes #3521 Generated-By: PostHog Code Task-Id: 45791732-58e8-41c9-b616-4a91018e388d
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a gap in the update_rom flow where manually setting/changing a LaunchBox ID (“Update metadata” from the ROM edit dialog) would fetch LaunchBox metadata but never resolve/copy local LaunchBox media (notably videos) into RomM’s resource store.
Changes:
- Pass
fs_nameandplatform_slugtoLaunchBoxHandler.get_rom_by_idso local LaunchBox media can resolve during manual (re)match. - Run
populate_rom_specific_pathsfor LaunchBox metadata duringupdate_romto generate{type}_pathentries (e.g.video_path). - Add a LaunchBox
store_media_fileloop (including stale-media cleanup on ID change) mirroring the existing ScreenScraper logic, and add an endpoint test covering local video import.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| backend/endpoints/roms/init.py | Ensures LaunchBox manual rematch resolves local media paths and copies media into the resource store (with cleanup when LaunchBox ID changes). |
| backend/tests/endpoints/roms/test_rom.py | Adds a regression test asserting LaunchBox local video is assigned a video_path and copied via store_media_file during update_rom. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Explain the changes or enhancements you are proposing with this pull request.
Manually (re)matching a LaunchBox ID through the ROM edit dialog ("Update metadata") never imported any LaunchBox media (e.g. local videos), even with
videoinscan.media. Unlike the ScreenScraper block in the same handler, the LaunchBox branch ofupdate_rom:get_rom_by_idwithoutfs_name/platform_slug, so local-media merging never ran;populate_rom_specific_paths, so no{type}_path(e.g.video_path) was generated;store_media_fileloop, so nothing was ever copied into the resource store.This PR fixes the LaunchBox branch of
update_romto:fs_name/platform_slugtoget_rom_by_idso local LaunchBox media resolves.populate_rom_specific_pathson the fetched metadata to generate media paths.store_media_fileloop mirroring the ScreenScraper/scan blocks, which also clears stale media when the LaunchBox ID changes.Note: the scan/rescan path already imports LaunchBox video correctly (
populate_rom_specific_pathsis called inscan_handler.pywith a persisted ROM, and the scan socket store loop copies it). The gallery-art (non-video images) question raised in the issue is intentionally out of scope here, as it needs a product/UI decision plus a new frontend surface.AI assistance disclosure: This change was written with AI assistance (PostHog Code / Claude). The investigation, code changes, and tests were AI-generated and reviewed before submission.
Fixes #3521
Checklist
Please check all that apply.
Screenshots (if applicable)
N/A (backend-only change)
Created with PostHog Code