feat(server/m7-380): one-shot MBID backfill worker for existing libraries

Adds a boot-time goroutine that walks albums with NULL mbid, re-reads
tags from one track per album via dhowden/tag, and persists album + artist
MBIDs. Healed albums also get their cover_art_source='none' cleared so the
enricher's next batch retries the MBCAA fetch. Caps at 5000 albums per
boot to avoid stalling startup on huge libraries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-04 19:40:27 -04:00
parent 26f4c7a79f
commit 34615fffbd
6 changed files with 228 additions and 0 deletions
+10
View File
@@ -83,6 +83,16 @@ func run() error {
})
coverEnricher := coverart.NewEnricher(pool, logger.With("component", "coverart"), coverFetcher, cfg.Library.CoverArtFromMBCAA)
// One-shot MBID backfill: walks albums with NULL mbid, reads tags from
// one track per album, persists the MBID. Filling in MBIDs unblocks the
// cover enricher for libraries that were imported before scanner-side
// MBID extraction landed (M7 #380).
go func() {
if _, err := library.BackfillMBIDs(ctx, pool, logger.With("component", "mbid_backfill"), 5000); err != nil {
logger.Warn("mbid backfill failed", "err", err)
}
}()
if cfg.Library.ScanOnStartup && len(cfg.Library.ScanPaths) > 0 {
go func() {
if _, err := scanner.Scan(ctx); err != nil {