fix(subsonic): getLyrics by title alone answers nothing when two artists share the title (#8128)
release / go (push) Successful in 1m46s
release / web (push) Successful in 1m15s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m13s
release / android (push) Successful in 4m45s
release / Build signed APK (push) Successful in 5m16s
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

An app that asks for lyrics by title without an artist got the first
matching song with lyrics, which could be another artist's song of the
same name. It now answers empty, so the app can look elsewhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-28 13:51:25 -05:00
co-authored by Claude Opus 5.5
parent 6ed9db4f0c
commit c662bc1f90
2 changed files with 47 additions and 2 deletions
+28
View File
@@ -139,6 +139,34 @@ func TestGetLyrics_ReadsTheSongsLrcByIdOrByName(t *testing.T) {
if byName.Lyrics != (Lyrics{}) {
t.Errorf("another artist's Dusk = %+v, want no lyrics", byName.Lyrics)
}
// Without an artist, a title only one artist has is that artist's song;
// a title two artists have is neither's, even when only one has lyrics.
if code := call(t, f.browse().getLyrics, f.user, "title=Dusk", &byName); code != 0 {
t.Fatalf("getLyrics: error %d", code)
}
if byName.Lyrics.Value != "First light\nGone by noon" {
t.Errorf("Dusk by title alone = %+v, want Tin Orchard's text", byName.Lyrics)
}
ctx := context.Background()
q := dbq.New(f.pool)
other, err := q.UpsertArtist(ctx, dbq.UpsertArtistParams{Name: "Quiet Harbour", SortName: "Quiet Harbour"})
if err != nil {
t.Fatal(err)
}
if _, err := q.UpsertTrack(ctx, dbq.UpsertTrackParams{
Title: "Dusk", AlbumID: f.albums["Paper Boats"].ID, ArtistID: other.ID,
FilePath: filepath.Join(dir, "Quiet Harbour - Dusk.flac"), DurationMs: 200_000,
}); err != nil {
t.Fatal(err)
}
byName.Lyrics = Lyrics{}
if code := call(t, f.browse().getLyrics, f.user, "title=Dusk", &byName); code != 0 {
t.Fatalf("getLyrics: error %d", code)
}
if byName.Lyrics != (Lyrics{}) {
t.Errorf("Dusk by title alone, two artists' = %+v, want no lyrics", byName.Lyrics)
}
}
// Artist info is the MusicBrainz id and the similar artists in the library,