From 0586e93655ae87c5b648050dba8bc0a7305d7603 Mon Sep 17 00:00:00 2001 From: emeric Date: Sat, 28 Nov 2020 22:39:12 +0100 Subject: [PATCH] Subsonic API: improved compatibility --- src/libs/subsonic/impl/SubsonicResource.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libs/subsonic/impl/SubsonicResource.cpp b/src/libs/subsonic/impl/SubsonicResource.cpp index 65f7427e..4a010378 100644 --- a/src/libs/subsonic/impl/SubsonicResource.cpp +++ b/src/libs/subsonic/impl/SubsonicResource.cpp @@ -53,6 +53,7 @@ using namespace Database; static const std::string genreClusterName {"GENRE"}; static const std::string reportedStarredDate {"2000-01-01T00:00:00"}; static const std::string reportedDummyDate {"2000-01-01T00:00:00"}; +static const unsigned long reportedDummyDateULong {946684800000}; // 2000-01-01T00:00:00 UTC namespace API::Subsonic { @@ -377,7 +378,7 @@ releaseToResponseNode(const Release::pointer& release, Session& dbSession, const { albumNode.setAttribute("name", release->getName()); albumNode.setAttribute("songCount", release->getTracksCount()); - albumNode.setAttribute("duration", std::to_string(std::chrono::duration_cast(release->getDuration()).count())); + albumNode.setAttribute("duration", std::chrono::duration_cast(release->getDuration()).count()); } else { @@ -936,7 +937,10 @@ Response handleGetArtistsRequest(RequestContext& context) { Response response {Response::createOkResponse(context)}; + Response::Node& artistsNode {response.createNode("artists")}; + artistsNode.setAttribute("ignoredArticles", ""); + artistsNode.setAttribute("lastModified", reportedDummyDateULong); Response::Node& indexNode {artistsNode.createArrayChild("index")}; indexNode.setAttribute("name", "?"); @@ -1083,7 +1087,10 @@ Response handleGetIndexesRequest(RequestContext& context) { Response response {Response::createOkResponse(context)}; + Response::Node& artistsNode {response.createNode("indexes")}; + artistsNode.setAttribute("ignoredArticles", ""); + artistsNode.setAttribute("lastModified", reportedDummyDateULong); Response::Node& indexNode {artistsNode.createArrayChild("index")}; indexNode.setAttribute("name", "?");