fix(subsonic): find lyrics by artist or albumartist (#4093)

* find artist by multivalued exact match, instead of 'artist' field

* check if lyrics are not empty

* refactor(filters): rename function to better reflect its purpose

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
Co-authored-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Kendall Garner
2025-05-21 13:36:26 +00:00
committed by GitHub
parent 6880cffd16
commit 924354eb4b
2 changed files with 13 additions and 6 deletions
+12 -5
View File
@@ -108,12 +108,19 @@ func SongsByRandom(genre string, fromYear, toYear int) Options {
return addDefaultFilters(options)
}
func SongWithArtistTitle(artist, title string) Options {
func SongWithLyrics(artist, title string) Options {
return addDefaultFilters(Options{
Sort: "updated_at",
Order: "desc",
Max: 1,
Filters: And{Eq{"artist": artist, "title": title}},
Sort: "updated_at",
Order: "desc",
Max: 1,
Filters: And{
Eq{"title": title},
NotEq{"lyrics": "[]"},
Or{
persistence.Exists("json_tree(participants, '$.albumartist')", Eq{"value": artist}),
persistence.Exists("json_tree(participants, '$.artist')", Eq{"value": artist}),
},
},
})
}