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

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:
2026-11-25 12:08:55 -05:00
co-authored by Claude Opus 5.5
parent 2bc6c60938
commit 6351b4651a
22 changed files with 555 additions and 108 deletions
+18 -8
View File
@@ -84,7 +84,12 @@ var audioExtensions = map[string]bool{
// track, was split into an album per track artist; a re-read files each
// track back on the one album, and the scan's tidy-up removes the rows
// it leaves empty.
const tagReadVersion int16 = 9
// 10: a credit that names a guest ("X feat. Y") or lists several artists
// (Picard's ARTISTS) is filed under its first artist and kept as the
// track's credit, rather than becoming an artist of its own; the scan's
// tidy-up removes the credit-named artists it leaves empty. A Vorbis
// file's artist id is its first, not its last.
const tagReadVersion int16 = 10
type Stats struct {
Scanned int `json:"scanned"`
@@ -367,13 +372,14 @@ func (s *Scanner) scanFile(
return pgtype.UUID{}, false, fmt.Errorf("tag read: %w", err)
}
ids := ReadTagMBIDs(meta)
albumMBID, artistMBID := ids.Release, ids.Artist
albumMBID := ids.Release
recordingMBID, releaseGroupMBID := ids.Recording, ids.ReleaseGroup
artistName := meta.Artist()
if artistName == "" {
artistName = "Unknown Artist"
}
// A guest or a second artist in the credit does not get an artist of
// their own: the track is filed under the first, and the full credit is
// kept to show with it (artistcredit.go).
credit := readArtistCredit(meta, f, ids)
artistName := credit.Name
albumTitle := meta.Album()
if albumTitle == "" {
albumTitle = "Unknown Album"
@@ -383,7 +389,7 @@ func (s *Scanner) scanFile(
trackTitle = strings.TrimSuffix(filepath.Base(path), filepath.Ext(path))
}
artist, err := s.resolveArtist(ctx, q, artistName, artistMBID)
artist, err := s.resolveArtist(ctx, q, artistName, credit.MBID)
if err != nil {
return pgtype.UUID{}, false, fmt.Errorf("artist: %w", err)
}
@@ -392,7 +398,7 @@ func (s *Scanner) scanFile(
// lands on one album instead of one per track artist. The track keeps
// its own artist.
albumArtist := artist
if name := strings.TrimSpace(meta.AlbumArtist()); name != "" && name != artistName {
if name := withoutGuests(strings.TrimSpace(meta.AlbumArtist())); name != "" && name != artistName {
albumArtist, err = s.resolveArtist(ctx, q, name, ids.AlbumArtist)
if err != nil {
return pgtype.UUID{}, false, fmt.Errorf("album artist: %w", err)
@@ -479,6 +485,10 @@ func (s *Scanner) scanFile(
// Stamped so a future extraction fix can find this row again.
TagReadVersion: tagReadVersion,
}
if credit.Credit != "" {
c := credit.Credit
params.ArtistCredit = &c
}
if trackNum > 0 {
v := int32(trackNum)
params.TrackNumber = &v