From 39dff9c7c427811930cd9e529d2428a0a9012e50 Mon Sep 17 00:00:00 2001 From: emeric Date: Thu, 19 Feb 2026 22:16:41 +0100 Subject: [PATCH] OS API: fixed regression on roles filed, fixes #818 --- src/libs/subsonic/impl/responses/Artist.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libs/subsonic/impl/responses/Artist.cpp b/src/libs/subsonic/impl/responses/Artist.cpp index a7642bbf..577d97c7 100644 --- a/src/libs/subsonic/impl/responses/Artist.cpp +++ b/src/libs/subsonic/impl/responses/Artist.cpp @@ -75,8 +75,10 @@ namespace lms::api::subsonic artistNode.setAttribute("coverArt", idToString(coverArtId)); } + bool hasAlbums{}; { std::size_t count{ Release::getCount(context.getDbSession(), Release::FindParameters{}.setArtist(artist->getId())) }; + hasAlbums = count > 0; // TODO: not very efficient Release::find(context.getDbSession(), Release::FindParameters{}.setTrackArtist(artist->getId()), [&](const db::Release::pointer& release) { @@ -105,11 +107,13 @@ namespace lms::api::subsonic artistNode.setAttribute("sortName", artist->getSortName()); - // roles Response::Node roles; artistNode.createEmptyArrayValue("roles"); for (const TrackArtistLinkType linkType : TrackArtistLink::findUsedTypes(context.getDbSession(), artist->getId())) artistNode.addArrayValue("roles", utils::toString(linkType)); + + if (hasAlbums) + artistNode.addArrayValue("roles", "albumartist"); } return artistNode;