Tidy up remote control protobuf.

This commit is contained in:
John Maguire 2013-01-14 16:17:36 +01:00
parent e915d2e993
commit 555467e764
3 changed files with 13 additions and 15 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;