fix: FLAC, Ogg and Opus tracks carry their MusicBrainz recording id from the tag: one reader in library gives the scanner, the backfills and the importer the same ids, and the next scan re-reads the library (#5637)
release / govulncheck (push) Successful in 20s
release / web (push) Successful in 1m30s
release / go (push) Successful in 1m50s
release / integration (push) Successful in 5m19s
release / android (push) Successful in 5m50s
release / Build signed APK (releases and dev) (push) Successful in 6m12s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 16s
release / Verify release artifacts (tag releases only) (push) Skipped

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 15:55:25 -04:00
co-authored by Claude Opus 5.5
parent c1305a547d
commit 9e7d50b38e
5 changed files with 109 additions and 76 deletions
+2 -20
View File
@@ -10,7 +10,6 @@ import (
"strings"
"github.com/dhowden/tag"
"github.com/dhowden/tag/mbz"
"git.fabledsword.com/bvandeusen/minstrel/internal/acoustid"
"git.fabledsword.com/bvandeusen/minstrel/internal/library"
@@ -136,15 +135,8 @@ func readFile(ctx context.Context, root, path string) File {
f.Title, f.Artist, f.AlbumArtist, f.Album = m.Title(), m.Artist(), m.AlbumArtist(), m.Album()
f.Track, _ = m.Track()
f.Disc, _ = m.Disc()
info := mbz.Extract(m)
f.GroupMBID = clean(info.Get(mbz.ReleaseGroup))
f.ReleaseMBID = clean(info.Get(mbz.Album))
f.RecordingMBID = clean(info.Get(mbz.Recording))
if f.RecordingMBID == "" && m.Format() == tag.VORBIS {
// Picard's Vorbis key for the recording is MUSICBRAINZ_TRACKID, which
// mbz files under its release-track name.
f.RecordingMBID = clean(info.Get(mbz.Track))
}
ids := library.ReadTagMBIDs(m)
f.GroupMBID, f.ReleaseMBID, f.RecordingMBID = ids.ReleaseGroup, ids.Release, ids.Recording
return f
}
@@ -155,16 +147,6 @@ func rel(root, path string) string {
return filepath.Base(path)
}
// clean takes the first of NUL-separated values: ID3v2.4 multi-values.
func clean(s string) string {
for _, part := range strings.Split(s, "\x00") {
if t := strings.TrimSpace(part); t != "" {
return t
}
}
return ""
}
// inspect reads every audio file under root and asks the printer about each.
// fingerprinted reports whether the printer answered at all.
func inspect(ctx context.Context, root string, p Printer) (files []File, fingerprinted bool, err error) {