mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-10 23:56:43 +02:00
Send control command as parameter
This commit is contained in:
parent
4064766818
commit
de9e3496df
2 changed files with 37 additions and 30 deletions
|
@ -83,6 +83,7 @@ void CtrlScript::send(const jsonrpcpp::Request& request, const OnResponse& respo
|
|||
request_callbacks_[request.id()] = response_handler;
|
||||
|
||||
std::string msg = request.to_json().dump() + "\n";
|
||||
LOG(INFO, SCRIPT_LOG_TAG) << "Sending request: " << msg;
|
||||
in_.write(msg.data(), msg.size());
|
||||
in_.flush();
|
||||
}
|
||||
|
@ -485,7 +486,10 @@ void PcmStream::control(const jsonrpcpp::Request& request, const CtrlScript::OnR
|
|||
LOG(INFO, LOG_TAG) << "Stream '" << getId() << "' received command: '" << command << "', params: '" << request.params().to_json() << "'\n";
|
||||
if (ctrl_script_)
|
||||
{
|
||||
jsonrpcpp::Request req(++req_id_, "Player." + command, request.params().has("params") ? request.params().get("params") : json{});
|
||||
jsonrpcpp::Parameter params{"command", command};
|
||||
if (request.params().has("params"))
|
||||
params.add("params", request.params().get("params"));
|
||||
jsonrpcpp::Request req(++req_id_, "Player.Control", params);
|
||||
ctrl_script_->send(req, response_handler);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue