diff --git a/ext/libclementine-remote/remotecontrolmessages.proto b/ext/libclementine-remote/remotecontrolmessages.proto index e02c60a3f..3298b6db8 100644 --- a/ext/libclementine-remote/remotecontrolmessages.proto +++ b/ext/libclementine-remote/remotecontrolmessages.proto @@ -152,6 +152,7 @@ message ResponseUpdateTrackPosition { // The connect message containing the authentication code message RequestConnect { optional int32 auth_code = 1; + optional bool send_playlist_songs = 2; } // Respone, why the connection was closed @@ -176,7 +177,7 @@ message RequestSetTrackPosition { // The message itself message Message { - optional int32 version = 1 [default=4]; + optional int32 version = 1 [default=5]; optional MsgType type = 2 [default=UNKNOWN]; // What data is in the message? optional RequestConnect request_connect = 21; diff --git a/src/networkremote/incomingdataparser.cpp b/src/networkremote/incomingdataparser.cpp index e3aae3cc5..0b6672fb3 100644 --- a/src/networkremote/incomingdataparser.cpp +++ b/src/networkremote/incomingdataparser.cpp @@ -69,8 +69,7 @@ void IncomingDataParser::Parse(const pb::remote::Message& msg) { // Now check what's to do switch (msg.type()) { - case pb::remote::CONNECT: emit SendClementineInfo(); - emit SendFirstData(); + case pb::remote::CONNECT: ClientConnect(msg); break; case pb::remote::DISCONNECT: close_connection_ = true; break; @@ -159,3 +158,16 @@ void IncomingDataParser::SetShuffleMode(const pb::remote::Shuffle& shuffle) { default: break; } } + +void IncomingDataParser::ClientConnect(const pb::remote::Message& msg) { + // Always sned the Clementine infos + emit SendClementineInfo(); + + // Check if we should send the first data + if (!msg.request_connect().has_send_playlist_songs() // legacy + || msg.request_connect().send_playlist_songs()) { + emit SendFirstData(true); + } else { + emit SendFirstData(false); + } +} diff --git a/src/networkremote/incomingdataparser.h b/src/networkremote/incomingdataparser.h index 7c13c4a0f..cba3569d5 100644 --- a/src/networkremote/incomingdataparser.h +++ b/src/networkremote/incomingdataparser.h @@ -18,7 +18,7 @@ public slots: signals: void SendClementineInfo(); - void SendFirstData(); + void SendFirstData(bool send_playlist_songs); void SendAllPlaylists(); void SendPlaylistSongs(int id); @@ -36,7 +36,6 @@ signals: void SetShuffleMode(PlaylistSequence::ShuffleMode mode); void SeekTo(int seconds); - private: Application* app_; bool close_connection_; @@ -45,6 +44,7 @@ private: void ChangeSong(const pb::remote::Message& msg); void SetRepeatMode(const pb::remote::Repeat& repeat); void SetShuffleMode(const pb::remote::Shuffle& shuffle); + void ClientConnect(const pb::remote::Message& msg); }; #endif // INCOMINGDATAPARSER_H diff --git a/src/networkremote/networkremote.cpp b/src/networkremote/networkremote.cpp index 8acdb8dae..f410b56a2 100644 --- a/src/networkremote/networkremote.cpp +++ b/src/networkremote/networkremote.cpp @@ -120,8 +120,8 @@ void NetworkRemote::AcceptConnection() { // Setting up the signals, but only once connect(incoming_data_parser_.get(), SIGNAL(SendClementineInfo()), outgoing_data_creator_.get(), SLOT(SendClementineInfo())); - connect(incoming_data_parser_.get(), SIGNAL(SendFirstData()), - outgoing_data_creator_.get(), SLOT(SendFirstData())); + connect(incoming_data_parser_.get(), SIGNAL(SendFirstData(bool)), + outgoing_data_creator_.get(), SLOT(SendFirstData(bool))); connect(incoming_data_parser_.get(), SIGNAL(SendAllPlaylists()), outgoing_data_creator_.get(), SLOT(SendAllPlaylists())); connect(incoming_data_parser_.get(), SIGNAL(SendPlaylistSongs(int)), diff --git a/src/networkremote/outgoingdatacreator.cpp b/src/networkremote/outgoingdatacreator.cpp index f7450291f..16beb95e7 100644 --- a/src/networkremote/outgoingdatacreator.cpp +++ b/src/networkremote/outgoingdatacreator.cpp @@ -151,7 +151,7 @@ void OutgoingDataCreator::PlaylistRenamed(int id, const QString& new_name) { SendAllPlaylists(); } -void OutgoingDataCreator::SendFirstData() { +void OutgoingDataCreator::SendFirstData(bool send_playlist_songs) { // First Send the current song PlaylistItemPtr item = app_->player()->GetCurrentItem(); if (!item) { @@ -170,7 +170,9 @@ void OutgoingDataCreator::SendFirstData() { SendAllPlaylists(); // Send the tracks of the active playlist - SendPlaylistSongs(app_->playlist_manager()->active_id()); + if (send_playlist_songs) { + SendPlaylistSongs(app_->playlist_manager()->active_id()); + } // Send the current random and repeat mode SendShuffleMode(app_->playlist_manager()->sequence()->shuffle_mode()); diff --git a/src/networkremote/outgoingdatacreator.h b/src/networkremote/outgoingdatacreator.h index 83be0b0b4..73b18ece4 100644 --- a/src/networkremote/outgoingdatacreator.h +++ b/src/networkremote/outgoingdatacreator.h @@ -26,7 +26,7 @@ public: public slots: void SendClementineInfo(); void SendAllPlaylists(); - void SendFirstData(); + void SendFirstData(bool send_playlist_songs); void SendPlaylistSongs(int id); void PlaylistChanged(Playlist*); void VolumeChanged(int volume);