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:
@@ -630,25 +630,60 @@ func TestScanner_AlbumArtistKeepsAnAlbumTogether_Integration(t *testing.T) {
|
||||
if got["Summer Hits"].tracks != 2 || got["Summer Hits"].trackArtists != 2 {
|
||||
t.Errorf("Summer Hits = %+v, want 2 tracks by 2 artists on one album", got["Summer Hits"])
|
||||
}
|
||||
if got["Night Drive"].tracks != 2 || got["Night Drive"].trackArtists != 2 {
|
||||
t.Errorf("Night Drive = %+v, want 2 tracks by 2 artists on one album", got["Night Drive"])
|
||||
// The guest is a credit on the track, not an artist of their own.
|
||||
if got["Night Drive"].tracks != 2 || got["Night Drive"].trackArtists != 1 {
|
||||
t.Errorf("Night Drive = %+v, want 2 tracks, both filed under Paper Lanterns", got["Night Drive"])
|
||||
}
|
||||
const guestCredit = "Paper Lanterns feat. Low Tide Choir"
|
||||
creditOf := func() (artist string, credit *string) {
|
||||
t.Helper()
|
||||
if err := pool.QueryRow(ctx, `
|
||||
SELECT ar.name, t.artist_credit FROM tracks t JOIN artists ar ON ar.id = t.artist_id
|
||||
WHERE t.file_path = $1`, guest).Scan(&artist, &credit); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return artist, credit
|
||||
}
|
||||
if artist, credit := creditOf(); artist != "Paper Lanterns" || credit == nil || *credit != guestCredit {
|
||||
t.Errorf("guest track filed under %q with credit %v, want Paper Lanterns with credit %q", artist, credit, guestCredit)
|
||||
}
|
||||
creditArtists := func() int {
|
||||
t.Helper()
|
||||
var n int
|
||||
if err := pool.QueryRow(ctx, `SELECT count(*) FROM artists WHERE name = $1`, guestCredit).Scan(&n); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return n
|
||||
}
|
||||
if n := creditArtists(); n != 0 {
|
||||
t.Errorf("%d artists named %q, want none", n, guestCredit)
|
||||
}
|
||||
|
||||
// The guest track as the old filing left it: on an album of its own,
|
||||
// made long enough ago for the tidy-up, under an older tag-read version.
|
||||
// The guest track as the old filing left it: under an artist named for
|
||||
// the whole credit, on an album of its own, both made long enough ago for
|
||||
// the tidy-up, under an older tag-read version.
|
||||
if _, err := pool.Exec(ctx, `
|
||||
WITH g AS (SELECT artist_id FROM tracks WHERE file_path = $1),
|
||||
WITH ar AS (INSERT INTO artists (name, sort_name, created_at)
|
||||
VALUES ($2, lower($2), now() - interval '1 day') RETURNING id),
|
||||
a AS (INSERT INTO albums (title, sort_title, artist_id, created_at)
|
||||
SELECT 'Night Drive', 'night drive', artist_id, now() - interval '1 day' FROM g
|
||||
SELECT 'Night Drive', 'night drive', id, now() - interval '1 day' FROM ar
|
||||
RETURNING id)
|
||||
UPDATE tracks SET album_id = (SELECT id FROM a), tag_read_version = 8 WHERE file_path = $1`, guest); err != nil {
|
||||
UPDATE tracks SET album_id = (SELECT id FROM a), artist_id = (SELECT id FROM ar),
|
||||
artist_credit = NULL, tag_read_version = 8
|
||||
WHERE file_path = $1`, guest, guestCredit); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := scanner.Scan(ctx, nil); err != nil {
|
||||
t.Fatalf("rescan: %v", err)
|
||||
}
|
||||
if got := albums(); got["Night Drive"].tracks != 2 {
|
||||
t.Errorf("after the re-read, Night Drive = %+v, want both tracks back on one album", got["Night Drive"])
|
||||
if got := albums(); got["Night Drive"].tracks != 2 || got["Night Drive"].trackArtists != 1 {
|
||||
t.Errorf("after the re-read, Night Drive = %+v, want both tracks back on one album under Paper Lanterns", got["Night Drive"])
|
||||
}
|
||||
if artist, credit := creditOf(); artist != "Paper Lanterns" || credit == nil || *credit != guestCredit {
|
||||
t.Errorf("after the re-read, guest track filed under %q with credit %v, want Paper Lanterns with credit %q", artist, credit, guestCredit)
|
||||
}
|
||||
if n := creditArtists(); n != 0 {
|
||||
t.Errorf("after the re-read, %d artists named %q, want the tidy-up to remove it", n, guestCredit)
|
||||
}
|
||||
var empty int
|
||||
if err := pool.QueryRow(ctx,
|
||||
|
||||
Reference in New Issue
Block a user