fix(scanner): a featured guest or a listed collaborator is a credit on the track, not an artist of their own
release / web (push) Successful in 1m13s
release / go (push) Successful in 1m46s
release / govulncheck (push) Successful in 19s
release / integration (push) Successful in 3m52s
release / android (push) Successful in 4m11s
release / Build signed APK (push) Successful in 4m42s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 29s
release / Verify release artifacts (tag releases only) (push) Skipped
release / web (push) Successful in 1m13s
release / go (push) Successful in 1m46s
release / govulncheck (push) Successful in 19s
release / integration (push) Successful in 3m52s
release / android (push) Successful in 4m11s
release / Build signed APK (push) Successful in 4m42s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 29s
release / Verify release artifacts (tag releases only) (push) Skipped
A track tagged "Low Tide Choir feat. Ruby Calloway" was filed under an artist of that whole name, with its own page, its own place in the artist list and its own "Songs like" mix. It is now filed under Low Tide Choir and keeps "Low Tide Choir feat. Ruby Calloway" as its credit, shown wherever the track is listed, sent to Subsonic apps and scrobbled. A collaboration is split only when the file lists its artists one by one (Picard's ARTISTS tag, read from FLAC, Ogg, Opus, MP3 and M4A). "A & B" on its own may be one band, so it stays whole. A Vorbis file's artist id is now its first, not the guest's. Tag-read version 10 re-reads the library once; the scan's tidy-up removes the credit-named artists it leaves empty. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -22,7 +22,9 @@ import (
|
||||
// other seven would never be seen by browse or the taste profile.
|
||||
//
|
||||
// The comment block is read here directly, as the ID3v2 genre frame is in
|
||||
// id3v2genre.go. Every other field still comes from dhowden/tag.
|
||||
// id3v2genre.go, for the fields where a repeat matters: GENRE, and the
|
||||
// ARTISTS and MUSICBRAINZ_ARTISTID lists an artist credit is read from
|
||||
// (artistcredit.go). Every other field still comes from dhowden/tag.
|
||||
|
||||
// maxVorbisCommentSize caps a comment block or packet. Comments are kilobytes;
|
||||
// an embedded METADATA_BLOCK_PICTURE can take them to a few megabytes. The cap
|
||||
@@ -32,9 +34,17 @@ const maxVorbisCommentSize = 16 << 20
|
||||
var errMalformedComment = errors.New("library: malformed Vorbis comment")
|
||||
|
||||
// readFLACGenreValues returns every GENRE value in a FLAC file's comment block.
|
||||
// (nil, nil) means the file is readable and declares no genre. rs is seeked to
|
||||
// the start, so it is safe to call after dhowden/tag has consumed the reader.
|
||||
func readFLACGenreValues(rs io.ReadSeeker) ([]string, error) {
|
||||
// (nil, nil) means the file is readable and declares no genre.
|
||||
func readFLACGenreValues(rs io.ReadSeeker) ([]string, error) { return readFLACValues(rs, "GENRE") }
|
||||
|
||||
// readOggGenreValues returns every GENRE value in an Ogg Vorbis or Opus file.
|
||||
func readOggGenreValues(rs io.ReadSeeker) ([]string, error) { return readOggValues(rs, "GENRE") }
|
||||
|
||||
// readFLACValues returns every value of the comment field key in a FLAC
|
||||
// file's comment block, in file order. (nil, nil) means the file is readable
|
||||
// and has no such field. rs is seeked to the start, so it is safe to call after
|
||||
// dhowden/tag has consumed the reader.
|
||||
func readFLACValues(rs io.ReadSeeker, key string) ([]string, error) {
|
||||
if _, err := rs.Seek(0, io.SeekStart); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -82,7 +92,7 @@ func readFLACGenreValues(rs io.ReadSeeker) ([]string, error) {
|
||||
if _, err := io.ReadFull(rs, body); err != nil {
|
||||
return nil, errNoGenreFrame
|
||||
}
|
||||
return vorbisCommentGenres(body)
|
||||
return vorbisCommentValues(body, key)
|
||||
case 127: // invalid by spec; nothing after it can be trusted
|
||||
return nil, errNoGenreFrame
|
||||
}
|
||||
@@ -95,11 +105,12 @@ func readFLACGenreValues(rs io.ReadSeeker) ([]string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// readOggGenreValues returns every GENRE value in an Ogg Vorbis or Opus file.
|
||||
// The comments are the stream's second packet, which can span several pages
|
||||
// when it carries cover art, so pages are reassembled until it is complete.
|
||||
// Only the first logical stream is read; pages of any other are skipped.
|
||||
func readOggGenreValues(rs io.ReadSeeker) ([]string, error) {
|
||||
// readOggValues returns every value of the comment field key in an Ogg Vorbis
|
||||
// or Opus file. The comments are the stream's second packet, which can span
|
||||
// several pages when it carries cover art, so pages are reassembled until it
|
||||
// is complete. Only the first logical stream is read; pages of any other are
|
||||
// skipped.
|
||||
func readOggValues(rs io.ReadSeeker, key string) ([]string, error) {
|
||||
if _, err := rs.Seek(0, io.SeekStart); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -149,7 +160,7 @@ func readOggGenreValues(rs io.ReadSeeker) ([]string, error) {
|
||||
continue // the packet carries on in the next segment
|
||||
}
|
||||
if packetIdx == 1 {
|
||||
return oggCommentGenres(packet)
|
||||
return oggCommentValues(packet, key)
|
||||
}
|
||||
packetIdx++
|
||||
packet = packet[:0]
|
||||
@@ -157,24 +168,24 @@ func readOggGenreValues(rs io.ReadSeeker) ([]string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// oggCommentGenres strips the codec's comment-packet prefix. Ogg FLAC and Speex
|
||||
// oggCommentValues strips the codec's comment-packet prefix. Ogg FLAC and Speex
|
||||
// are rare enough to leave to dhowden/tag.
|
||||
func oggCommentGenres(packet []byte) ([]string, error) {
|
||||
func oggCommentValues(packet []byte, key string) ([]string, error) {
|
||||
switch {
|
||||
case bytes.HasPrefix(packet, []byte("\x03vorbis")):
|
||||
return vorbisCommentGenres(packet[7:])
|
||||
return vorbisCommentValues(packet[7:], key)
|
||||
case bytes.HasPrefix(packet, []byte("OpusTags")):
|
||||
return vorbisCommentGenres(packet[8:])
|
||||
return vorbisCommentValues(packet[8:], key)
|
||||
}
|
||||
return nil, errNoGenreFrame
|
||||
}
|
||||
|
||||
// vorbisCommentGenres reads a comment block (vendor string, then a count of
|
||||
// vorbisCommentValues reads a comment block (vendor string, then a count of
|
||||
// length-prefixed "KEY=value" entries, little-endian lengths throughout) and
|
||||
// returns the GENRE values in file order. Field names are case-insensitive by
|
||||
// spec. Anything after the last entry, such as Vorbis's framing bit, is
|
||||
// ignored.
|
||||
func vorbisCommentGenres(b []byte) ([]string, error) {
|
||||
// returns the values of field key in file order. Field names are
|
||||
// case-insensitive by spec. Anything after the last entry, such as Vorbis's
|
||||
// framing bit, is ignored.
|
||||
func vorbisCommentValues(b []byte, key string) ([]string, error) {
|
||||
next := func() ([]byte, bool) {
|
||||
if len(b) < 4 {
|
||||
return nil, false
|
||||
@@ -203,8 +214,8 @@ func vorbisCommentGenres(b []byte) ([]string, error) {
|
||||
if !ok {
|
||||
return nil, errMalformedComment
|
||||
}
|
||||
key, value, found := strings.Cut(string(field), "=")
|
||||
if !found || !strings.EqualFold(key, "GENRE") {
|
||||
name, value, found := strings.Cut(string(field), "=")
|
||||
if !found || !strings.EqualFold(name, key) {
|
||||
continue
|
||||
}
|
||||
if value = strings.TrimSpace(value); value != "" {
|
||||
|
||||
Reference in New Issue
Block a user