fix(library): preserve per-track artwork during scan, cache folder lookups

The scan loop called update_album_group_artwork after every successful
track insert, which propagated one track's artwork to every track in
the same group. Tracks with unique embedded covers ended up sharing
whichever cover was processed last. Drop the call; per-track artwork
is resolved correctly by extract_artwork (embedded) + find_folder_artwork
(cover.jpg fallback) before insert_track.

Replace the propagation's caching effect with an in-memory per-folder
HashMap that memoizes find_folder_artwork for the duration of the scan
run, avoiding repeated folder walks for tracks without embedded art.

Mark update_album_group_artwork #[deprecated] so no future caller
reintroduces the bug. Keep it compilable.

Existing libraries already have collapsed artwork paths in the DB and
need a re-scan to recover per-track covers; called out in release notes.

cc
This commit is contained in:
vicrodh committed 2026-05-06 16:32:27 -06:00
1 parent 74289fb682
commit 7eba2749f5
2 files changed
+28 -10

No files matched your search

+9 -1
View File
@@ -1557,7 +1557,15 @@ impl LibraryDatabase {
Ok(())
}
/// Update artwork path for all tracks in an album group
/// Update artwork path for all tracks in an album group.
///
/// **Deprecated**: this was used inside the scan loop to backfill
/// artwork across tracks in the same group, but it pisses every
/// track's individual artwork in the process — destroying unique
/// per-track embedded covers. Per-track artwork is now resolved
/// individually at scan time. Kept compilable for any caller that
/// might still exist; do not introduce new callers.
#[deprecated(note = "Was destructive in scan loop; per-track artwork is resolved during scan instead")]
pub fn update_album_group_artwork(
&self,
group_key: &str,