mirror of
https://github.com/badaix/snapcast.git
synced 2025-04-29 02:07:55 +02:00
Added Stream.SetMeta and Stream.OnMetadata to JSON-RPC docs.
Also removed some code comments related to these. Added Stream.SetMeta and Stream.OnMetadata to JSON-RPC docs. Also removed some code comments related to these.
This commit is contained in:
parent
a99aed9ffa
commit
ea1236feef
3 changed files with 20 additions and 8 deletions
|
@ -157,6 +157,7 @@ The Server JSON object contains a list of Groups and Streams. Every Group holds
|
|||
* Stream
|
||||
* [Stream.AddStream](#streamaddstream)
|
||||
* [Stream.RemoveStream](#streamremovestream)
|
||||
* [Stream.SetMeta](#streamaddmeta)
|
||||
|
||||
### Notifications
|
||||
* Client
|
||||
|
@ -170,6 +171,7 @@ The Server JSON object contains a list of Groups and Streams. Every Group holds
|
|||
* [Group.OnStreamChanged](#grouponstreamchanged)
|
||||
* [Group.OnNameChanged](#grouponnamechanged)
|
||||
* Stream
|
||||
* [Stream.OnMetadata](#streamonmetadata)
|
||||
* [Stream.OnUpdate](#streamonupdate)
|
||||
* Server
|
||||
* [Server.OnUpdate](#serveronupdate)
|
||||
|
@ -377,6 +379,18 @@ The Server JSON object contains a list of Groups and Streams. Every Group holds
|
|||
{"id":8,"jsonrpc":"2.0","result":{"stream_id":"stream 2"}}
|
||||
```
|
||||
|
||||
|
||||
### Stream.SetMeta
|
||||
#### Request
|
||||
```json
|
||||
{"id":4,"jsonrpc":"2.0","method":"Stream.SetMeta","params":{"id":"Spotify", "meta": {"album": "some album", "artist": "some artist", "track": "some track"...}}}
|
||||
```
|
||||
|
||||
#### Response
|
||||
```json
|
||||
{"id":4,"jsonrpc":"2.0","result":{"stream_id":"Spotify"}}
|
||||
```
|
||||
|
||||
## Notifications
|
||||
### Client.OnConnect
|
||||
```json
|
||||
|
@ -423,6 +437,11 @@ The Server JSON object contains a list of Groups and Streams. Every Group holds
|
|||
{"jsonrpc":"2.0","method":"Stream.OnUpdate","params":{"id":"stream 1","stream":{"id":"stream 1","status":"idle","uri":{"fragment":"","host":"","path":"/tmp/snapfifo","query":{"chunk_ms":"20","codec":"flac","name":"stream 1","sampleformat":"48000:16:2"},"raw":"pipe:///tmp/snapfifo?name=stream 1","scheme":"pipe"}}}}
|
||||
```
|
||||
|
||||
### Stream.OnMetadata
|
||||
```json
|
||||
{"jsonrpc":"2.0","method":"Stream.OnMetadata","params":{"id":"stream 1", "meta": {"album": "some album", "artist": "some artist", "track": "some track"...}}}
|
||||
```
|
||||
|
||||
### Server.OnUpdate
|
||||
```json
|
||||
{"jsonrpc":"2.0","method":"Server.OnUpdate","params":{"server":{"groups":[{"clients":[{"config":{"instance":2,"latency":6,"name":"123 456","volume":{"muted":false,"percent":48}},"connected":true,"host":{"arch":"x86_64","ip":"127.0.0.1","mac":"00:21:6a:7d:74:fc","name":"T400","os":"Linux Mint 17.3 Rosa"},"id":"00:21:6a:7d:74:fc#2","lastSeen":{"sec":1488025751,"usec":654777},"snapclient":{"name":"Snapclient","protocolVersion":2,"version":"0.10.0"}}],"id":"4dcc4e3b-c699-a04b-7f0c-8260d23c43e1","muted":false,"name":"","stream_id":"stream 2"}],"server":{"host":{"arch":"x86_64","ip":"","mac":"","name":"T400","os":"Linux Mint 17.3 Rosa"},"snapserver":{"controlProtocolVersion":1,"name":"Snapserver","protocolVersion":1,"version":"0.10.0"}},"streams":[{"id":"stream 1","status":"idle","uri":{"fragment":"","host":"","path":"/tmp/snapfifo","query":{"chunk_ms":"20","codec":"flac","name":"stream 1","sampleformat":"48000:16:2"},"raw":"pipe:///tmp/snapfifo?name=stream 1","scheme":"pipe"}},{"id":"stream 2","status":"idle","uri":{"fragment":"","host":"","path":"/tmp/snapfifo","query":{"chunk_ms":"20","codec":"flac","name":"stream 2","sampleformat":"48000:16:2"},"raw":"pipe:///tmp/snapfifo?name=stream 2","scheme":"pipe"}}]}}}
|
||||
|
|
|
@ -52,7 +52,7 @@ void Server::onNewSession(const std::shared_ptr<StreamSession>& session)
|
|||
void Server::onMetaChanged(const PcmStream* pcmStream)
|
||||
{
|
||||
// clang-format off
|
||||
// Notification: {"jsonrpc":"2.0","method":"Stream.OnMetadata","params":{"id":"stream 1", "meta": {"album": "some album", "artist": "some artist", "track": "some track"...}}
|
||||
// Notification: {"jsonrpc":"2.0","method":"Stream.OnMetadata","params":{"id":"stream 1", "meta": {"album": "some album", "artist": "some artist", "track": "some track"...}}}
|
||||
// clang-format on
|
||||
|
||||
const auto meta = pcmStream->getMeta();
|
||||
|
@ -411,7 +411,6 @@ void Server::processRequest(const jsonrpcpp::request_ptr request, jsonrpcpp::ent
|
|||
// clang-format off
|
||||
// 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":"Spotify"}}
|
||||
// Call onMetaChanged(const PcmStream* pcmStream) for updates and notifications
|
||||
// clang-format on
|
||||
|
||||
LOG(INFO, LOG_TAG) << "Stream.SetMeta(" << request->params().get<std::string>("id") << ")" << request->params().get("meta") << "\n";
|
||||
|
@ -433,7 +432,6 @@ void Server::processRequest(const jsonrpcpp::request_ptr request, jsonrpcpp::ent
|
|||
// clang-format off
|
||||
// Request: {"id":4,"jsonrpc":"2.0","method":"Stream.AddStream","params":{"streamUri":"uri"}}
|
||||
// Response: {"id":4,"jsonrpc":"2.0","result":{"stream_id":"Spotify"}}
|
||||
// Call onMetaChanged(const PcmStream* pcmStream) for updates and notifications
|
||||
// clang-format on
|
||||
|
||||
LOG(INFO, LOG_TAG) << "Stream.AddStream(" << request->params().get("streamUri") << ")"
|
||||
|
@ -453,7 +451,6 @@ void Server::processRequest(const jsonrpcpp::request_ptr request, jsonrpcpp::ent
|
|||
// clang-format off
|
||||
// Request: {"id":4,"jsonrpc":"2.0","method":"Stream.RemoveStream","params":{"id":"Spotify"}}
|
||||
// Response: {"id":4,"jsonrpc":"2.0","result":{"stream_id":"Spotify"}}
|
||||
// Call onMetaChanged(const PcmStream* pcmStream) for updates and notifications
|
||||
// clang-format on
|
||||
|
||||
LOG(INFO, LOG_TAG) << "Stream.RemoveStream(" << request->params().get("id") << ")"
|
||||
|
|
|
@ -68,10 +68,6 @@ void StreamServer::addSession(const std::shared_ptr<StreamSession>& session)
|
|||
|
||||
void StreamServer::onMetaChanged(const PcmStream* pcmStream, std::shared_ptr<msg::StreamTags> meta)
|
||||
{
|
||||
// clang-format off
|
||||
// Notification: {"jsonrpc":"2.0","method":"Stream.OnMetadata","params":{"id":"stream 1", "meta": {"album": "some album", "artist": "some artist", "track": "some track"...}}
|
||||
// clang-format on
|
||||
|
||||
// Send meta to all connected clients
|
||||
|
||||
std::lock_guard<std::recursive_mutex> mlock(sessionsMutex_);
|
||||
|
|
Loading…
Add table
Reference in a new issue