From 555467e7649e8237355a45c640874dea71c8e7ac Mon Sep 17 00:00:00 2001 From: John Maguire Date: Mon, 14 Jan 2013 16:17:36 +0100 Subject: [PATCH] Tidy up remote control protobuf. --- .../remotecontrolmessages.proto | 19 +++++++++---------- src/networkremote/incomingdataparser.cpp | 2 +- src/networkremote/outgoingdatacreator.cpp | 7 +++---- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ext/libclementine-remote/remotecontrolmessages.proto b/ext/libclementine-remote/remotecontrolmessages.proto index b83e29926..7c3726f5c 100644 --- a/ext/libclementine-remote/remotecontrolmessages.proto +++ b/ext/libclementine-remote/remotecontrolmessages.proto @@ -8,7 +8,7 @@ enum MsgType { REQUEST_PLAYLIST_SONGS = 3; CHANGE_SONG = 4; SET_VOLUME = 5; - + // Messages send by both PLAY = 20; PLAYPAUSE = 21; @@ -16,8 +16,8 @@ enum MsgType { STOP = 23; NEXT = 24; PREV = 25; - TOOGLE_SHUFFLE = 26; - + TOGGLE_SHUFFLE = 26; + // Messages send from server to client INFOS = 40; CURRENT_METAINFOS = 41; @@ -34,17 +34,17 @@ enum EngineState { } message Message { - required int32 version = 1; + required int32 version = 1 [default=1]; required MsgType msgType = 2; - + optional EngineState state = 3; - optional ClementineInfos infos = 4; + optional ClementineInfo info = 4; optional SongMetadata currentSong = 5; optional int32 volume = 6; repeated Playlist playlists = 7; } -message ClementineInfos { +message ClementineInfo { optional string version = 1; } @@ -67,9 +67,8 @@ message SongMetadata { message Playlist { optional int32 id = 1; optional string name = 2; - optional int32 item_count = 3; - optional bool active = 4; - + optional bool active = 3; + repeated SongMetadata songs = 10; } diff --git a/src/networkremote/incomingdataparser.cpp b/src/networkremote/incomingdataparser.cpp index 34e6a0115..0b153fb44 100644 --- a/src/networkremote/incomingdataparser.cpp +++ b/src/networkremote/incomingdataparser.cpp @@ -91,7 +91,7 @@ void IncomingDataParser::Parse(const QByteArray& data) { break; case pb::remote::CHANGE_SONG: ChangeSong(&msg); break; - case pb::remote::TOOGLE_SHUFFLE: emit ShuffleCurrent(); + case pb::remote::TOGGLE_SHUFFLE: emit ShuffleCurrent(); break; default: break; } diff --git a/src/networkremote/outgoingdatacreator.cpp b/src/networkremote/outgoingdatacreator.cpp index a65e6c434..79895bde7 100644 --- a/src/networkremote/outgoingdatacreator.cpp +++ b/src/networkremote/outgoingdatacreator.cpp @@ -69,8 +69,8 @@ void OutgoingDataCreator::SendClementineInfos() { QString version = QString("%1 %2").arg(QCoreApplication::applicationName(), QCoreApplication::applicationVersion()); - pb::remote::ClementineInfos *infos = msg.mutable_infos(); - infos->set_version(version.toAscii()); + pb::remote::ClementineInfo *info = msg.mutable_info(); + info->set_version(version.toAscii()); SendDataToClients(&msg); } @@ -107,8 +107,8 @@ void OutgoingDataCreator::SendAllPlaylists() { pb::remote::Playlist* playlist = msg.add_playlists(); playlist->set_name(playlist_name.toStdString()); playlist->set_id(p->id()); - playlist->set_item_count(p->GetAllSongs().size()); playlist->set_active((p->id() == active_playlist)); + // TODO: Fill in the song metadata here. } SendDataToClients(&msg); @@ -217,7 +217,6 @@ void OutgoingDataCreator::SendPlaylistSongs(int id) { // Create a new playlist pb::remote::Playlist* pb_playlist = msg.add_playlists(); pb_playlist->set_id(id); - pb_playlist->set_item_count(playlist->GetAllSongs().size()); // Send all songs int index = 0;