mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-11 16:16:42 +02:00
Return the streams response to "SetProperty"
This commit is contained in:
parent
640b05db7d
commit
4c2636f358
3 changed files with 16 additions and 17 deletions
|
@ -220,8 +220,8 @@ void ControlSessionHttp::handle_request(http::request<Body, http::basic_fields<A
|
|||
if (req.target() != "/jsonrpc")
|
||||
return send(bad_request("Illegal request-target"));
|
||||
|
||||
return message_receiver_->onMessageReceived(shared_from_this(), std::string(req.body()),
|
||||
[req = std::move(req), send = std::move(send)](const std::string& response) {
|
||||
std::string request = req.body();
|
||||
return message_receiver_->onMessageReceived(shared_from_this(), request, [req = std::move(req), send = std::move(send)](const std::string& response) {
|
||||
http::response<http::string_body> res{http::status::ok, req.version()};
|
||||
res.set(http::field::server, HTTP_SERVER_NAME);
|
||||
res.set(http::field::content_type, "application/json");
|
||||
|
|
|
@ -483,14 +483,14 @@ void Server::processRequest(const jsonrpcpp::request_ptr request, const OnRespon
|
|||
if (stream == nullptr)
|
||||
throw jsonrpcpp::InternalErrorException("Stream not found", request->id());
|
||||
|
||||
stream->setProperty(*request, [](const jsonrpcpp::Response& response) {
|
||||
LOG(INFO, LOG_TAG) << "Received response for Stream.SetProperty, id: " << response.id() << ", result: " << response.result()
|
||||
<< ", error: " << response.error().code() << "\n";
|
||||
stream->setProperty(*request, [request, on_response](const jsonrpcpp::Response& props_response) {
|
||||
LOG(INFO, LOG_TAG) << "Received response for Stream.SetProperty, id: " << props_response.id() << ", result: " << props_response.result()
|
||||
<< ", error: " << props_response.error().code() << "\n";
|
||||
auto response = make_shared<jsonrpcpp::Response>(request->id(), props_response.result());
|
||||
on_response(response, nullptr);
|
||||
});
|
||||
|
||||
// Setup response
|
||||
// TODO: error handling
|
||||
result["id"] = streamId;
|
||||
return;
|
||||
}
|
||||
else if (request->method() == "Stream.AddStream")
|
||||
{
|
||||
|
|
|
@ -492,7 +492,6 @@ void PcmStream::setProperty(const jsonrpcpp::Request& request, const CtrlScript:
|
|||
|
||||
void PcmStream::control(const jsonrpcpp::Request& request, const CtrlScript::OnResponse& response_handler)
|
||||
{
|
||||
|
||||
std::string command = request.params().get("command");
|
||||
static std::set<std::string> supported_commands{"Next", "Previous", "Pause", "PlayPause", "Stop", "Play", "Seek", "SetPosition"};
|
||||
if ((supported_commands.find(command) == supported_commands.end()) ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue