Subsonic API: handle extensions

This commit is contained in:
emeric
2023-10-09 18:30:53 +02:00
parent caf558b6a0
commit 042cd54171
8 changed files with 120 additions and 71 deletions
@@ -0,0 +1,34 @@
#include "entrypoints/System.hpp"
namespace API::Subsonic
{
Response handlePingRequest(RequestContext& context)
{
return Response::createOkResponse(context.serverProtocolVersion);
}
Response handleGetLicenseRequest(RequestContext& context)
{
Response response{ Response::createOkResponse(context.serverProtocolVersion) };
Response::Node& licenseNode{ response.createNode("license") };
licenseNode.setAttribute("licenseExpires", "2025-09-03T14:46:43");
licenseNode.setAttribute("email", "foo@bar.com");
licenseNode.setAttribute("valid", true);
return response;
}
Response handleGetOpenSubsonicExtensions(RequestContext& context)
{
Response response{ Response::createOkResponse(context.serverProtocolVersion) };
{
Response::Node& transcodeOffsetNode{ response.createNode("openSubsonicExtensions") };
transcodeOffsetNode.setAttribute("name", "transcodeOffset");
transcodeOffsetNode.addArrayValue("versions", 1);
}
return response;
};
}