Summary #
- Decompose
ScanMusicFoldersinto cohesive stages (internal/library/scanner.go): ExtractwalkMusicFolder,scanAudioDirs,resolveAudioDir, andmergeScannedReleasefrom the monolithic 185-lineScanMusicFoldersloop, liftdirInfo,audioDirJob, andscanResultout of the loop body, and drop the always-nilerror return fromparseReleaseMetadataalong with its unreachable error branch. - Deterministic LRU eviction & stdlib map pruning (
internal/library/cache.go,internal/library/cache_test.go): Replacetime.Now().UnixNano()and rawint64atomics inThumbnailCachewith a strictly monotonicatomic.Uint64access counter (seq) so LRU eviction is deterministic without wall-clocktime.Sleepdelays in tests, and usemaps.DeleteFuncinDirCache.PruneKeeping. - Simplify image resize clamping (
internal/library/image.go): Use builtinmaxwhen computing target dimensions inResizeImage.