package library import ( "github.com/dhowden/tag" "github.com/dhowden/tag/mbz" ) // extractMBIDs reads MusicBrainz album and artist IDs from a tag.Metadata. // // Delegates to dhowden/tag/mbz, which knows the per-format Raw() conventions: // - Vorbis (FLAC/OGG) keys are lowercased by the parser. // - ID3v2 (MP3) TXXX frames are stored under "TXXX"/"TXXX_N" with // a *tag.Comm value whose Description holds the Picard tag name. // - MP4 (M4A) freeform iTunes atoms are stored under their bare sub-name. // // We previously hand-rolled this lookup against guessed keys // ("MUSICBRAINZ_ALBUMID", "TXXX:MusicBrainz Album Id", ...), none of which // dhowden actually produces — so every extraction returned ("",""), which // fed an empty MBID into both the scanner and the boot-time backfill. func extractMBIDs(m tag.Metadata) (albumMBID, artistMBID string) { info := mbz.Extract(m) return info.Get(mbz.Album), info.Get(mbz.Artist) }