mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-11 08:06:41 +02:00
Modified metadata interface to be tag independent, added JSON api.
This commit is contained in:
parent
67083975b0
commit
ce17b0010a
7 changed files with 116 additions and 33 deletions
|
@ -385,10 +385,14 @@ void StreamServer::ProcessRequest(const jsonrpcpp::request_ptr request, jsonrpcp
|
|||
{
|
||||
if (request->method.find("Stream.SetMeta") == 0)
|
||||
{
|
||||
/// Request: {"id":4,"jsonrpc":"2.0","method":"Stream.SetMeta","params":{"id":"Spotify","meta": {"album": "some album", "artist": "some artist", "track": "some track"...}}}
|
||||
/// Response: {"id":4,"jsonrpc":"2.0","result":{"stream_id":"stream 1"}}
|
||||
/// Request: {"id":4,"jsonrpc":"2.0","method":"Stream.SetMeta","params":{"stream_id":"Spotify",
|
||||
/// "meta": {"album": "some album", "artist": "some artist", "track": "some track"...}}}
|
||||
///
|
||||
/// Response: {"id":4,"jsonrpc":"2.0","result":{"stream_id":"Spotify"}}
|
||||
/// Call onMetaChanged(const PcmStream* pcmStream) for updates and notifications
|
||||
|
||||
LOG(INFO) << "Stream.SetMeta(" << request->params.get("stream_id") << ")" << request->params.get("meta") <<"\n";
|
||||
|
||||
// Find stream
|
||||
string streamId = request->params.get("stream_id");
|
||||
PcmStreamPtr stream = streamManager_->getStream(streamId);
|
||||
|
@ -396,14 +400,10 @@ void StreamServer::ProcessRequest(const jsonrpcpp::request_ptr request, jsonrpcp
|
|||
throw jsonrpcpp::InternalErrorException("Stream not found", request->id);
|
||||
|
||||
// Set metadata from request
|
||||
// stream->
|
||||
stream->setMeta(request->params.get("meta"));
|
||||
|
||||
// Update clients
|
||||
// Setup response
|
||||
|
||||
// Trigger notifications
|
||||
// onMetaChanged(stream);
|
||||
// notification.reset(new jsonrpcpp::Notification("Client.OnLatencyChanged", jsonrpcpp::Parameter("id", clientInfo->id, "latency", clientInfo->config.latency)));
|
||||
result["stream_id"] = streamId;
|
||||
}
|
||||
else
|
||||
throw jsonrpcpp::MethodNotFoundException(request->id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue