diff --git a/server/streamreader/control_error.cpp b/server/streamreader/control_error.cpp index 7f4afdc4..2a9ac8e0 100644 --- a/server/streamreader/control_error.cpp +++ b/server/streamreader/control_error.cpp @@ -46,17 +46,17 @@ std::string category::message(int value) const case ControlErrc::can_not_control: return "Stream can not be controlled"; case ControlErrc::can_go_next_is_false: - return "Stream property can_go_next is false"; + return "Stream property canGoNext is false"; case ControlErrc::can_go_previous_is_false: - return "Stream property can_go_previous is false"; + return "Stream property canGoPrevious is false"; case ControlErrc::can_play_is_false: - return "Stream property can_play is false"; + return "Stream property canPlay is false"; case ControlErrc::can_pause_is_false: - return "Stream property can_pause is false"; + return "Stream property canPause is false"; case ControlErrc::can_seek_is_false: - return "Stream property can_seek is false"; + return "Stream property canSeek is false"; case ControlErrc::can_control_is_false: - return "Stream property can_control is false"; + return "Stream property canControl is false"; case ControlErrc::parse_error: return "Parse error"; case ControlErrc::invalid_request: diff --git a/server/streamreader/pcm_stream.cpp b/server/streamreader/pcm_stream.cpp index ff83a1ef..18c1fd1d 100644 --- a/server/streamreader/pcm_stream.cpp +++ b/server/streamreader/pcm_stream.cpp @@ -320,6 +320,8 @@ const Properties& PcmStream::getProperties() const void PcmStream::setShuffle(bool shuffle, ResultHandler handler) { LOG(DEBUG, LOG_TAG) << "setShuffle: " << shuffle << "\n"; + if (!properties_.can_control) + return handler({ControlErrc::can_control_is_false}); sendRequest("Plugin.Stream.Player.SetProperty", {"shuffle", shuffle}, std::move(handler)); } @@ -327,6 +329,8 @@ void PcmStream::setShuffle(bool shuffle, ResultHandler handler) void PcmStream::setLoopStatus(LoopStatus status, ResultHandler handler) { LOG(DEBUG, LOG_TAG) << "setLoopStatus: " << status << "\n"; + if (!properties_.can_control) + return handler({ControlErrc::can_control_is_false}); sendRequest("Plugin.Stream.Player.SetProperty", {"loopStatus", to_string(status)}, std::move(handler)); } @@ -334,6 +338,8 @@ void PcmStream::setLoopStatus(LoopStatus status, ResultHandler handler) void PcmStream::setVolume(uint16_t volume, ResultHandler handler) { LOG(DEBUG, LOG_TAG) << "setVolume: " << volume << "\n"; + if (!properties_.can_control) + return handler({ControlErrc::can_control_is_false}); sendRequest("Plugin.Stream.Player.SetProperty", {"volume", volume}, std::move(handler)); } @@ -341,6 +347,8 @@ void PcmStream::setVolume(uint16_t volume, ResultHandler handler) void PcmStream::setRate(float rate, ResultHandler handler) { LOG(DEBUG, LOG_TAG) << "setRate: " << rate << "\n"; + if (!properties_.can_control) + return handler({ControlErrc::can_control_is_false}); sendRequest("Plugin.Stream.Player.SetProperty", {"rate", rate}, std::move(handler)); }