From b1c6cf8d7d5fe9a76e32f89fc9cf47f74212bd74 Mon Sep 17 00:00:00 2001 From: emeric Date: Mon, 2 Oct 2023 22:41:07 +0200 Subject: [PATCH] Subsonic API: added sortName extra field for artists --- src/libs/subsonic/impl/responses/Album.cpp | 4 ++-- src/libs/subsonic/impl/responses/Artist.cpp | 5 +++-- src/libs/subsonic/impl/responses/Song.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libs/subsonic/impl/responses/Album.cpp b/src/libs/subsonic/impl/responses/Album.cpp index aec0cc24..4aba2d16 100644 --- a/src/libs/subsonic/impl/responses/Album.cpp +++ b/src/libs/subsonic/impl/responses/Album.cpp @@ -93,12 +93,12 @@ namespace API::Subsonic if (const Wt::WDateTime dateTime{ Service::get()->getStarredDateTime(user->getId(), release->getId()) }; dateTime.isValid()) albumNode.setAttribute("starred", StringUtils::toISO8601String(dateTime)); // TODO report correct date/time - // OpenSubsonic specific field + // OpenSubsonic specific fields (must always be set) { std::optional mbid {release->getMBID()}; albumNode.setAttribute("musicBrainzId", mbid ? mbid->getAsString() : ""); } - + return albumNode; } } \ No newline at end of file diff --git a/src/libs/subsonic/impl/responses/Artist.cpp b/src/libs/subsonic/impl/responses/Artist.cpp index a527a437..93147eac 100644 --- a/src/libs/subsonic/impl/responses/Artist.cpp +++ b/src/libs/subsonic/impl/responses/Artist.cpp @@ -68,12 +68,13 @@ namespace API::Subsonic if (const Wt::WDateTime dateTime{ Service::get()->getStarredDateTime(user->getId(), artist->getId()) }; dateTime.isValid()) artistNode.setAttribute("starred", StringUtils::toISO8601String(dateTime)); - // OpenSubsonic specific field + // OpenSubsonic specific fields (must always be set) { std::optional mbid {artist->getMBID()}; artistNode.setAttribute("musicBrainzId", mbid ? mbid->getAsString() : ""); } - + artistNode.setAttribute("sortName", artist->getSortName()); + return artistNode; } } \ No newline at end of file diff --git a/src/libs/subsonic/impl/responses/Song.cpp b/src/libs/subsonic/impl/responses/Song.cpp index f737c49c..8e92b284 100644 --- a/src/libs/subsonic/impl/responses/Song.cpp +++ b/src/libs/subsonic/impl/responses/Song.cpp @@ -153,7 +153,7 @@ namespace API::Subsonic trackResponse.setAttribute("genre", clusters.front().front()->getName()); } - // OpenSubsonic specific field + // OpenSubsonic specific fields (must always be set) { std::optional mbid {track->getTrackMBID()}; trackResponse.setAttribute("musicBrainzId", mbid ? mbid->getAsString() : "");