mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-15 18:58:55 +01:00
Include rate song feature in network remote.
This commit is contained in:
parent
9987b3f9a9
commit
1254d025ab
@ -22,6 +22,7 @@ enum MsgType {
|
|||||||
BAN = 13;
|
BAN = 13;
|
||||||
STOP_AFTER = 17;
|
STOP_AFTER = 17;
|
||||||
GET_LIBRARY = 18;
|
GET_LIBRARY = 18;
|
||||||
|
RATE_SONG = 19;
|
||||||
|
|
||||||
// Messages send by both
|
// Messages send by both
|
||||||
DISCONNECT = 2;
|
DISCONNECT = 2;
|
||||||
@ -268,9 +269,13 @@ message ResponseSongOffer {
|
|||||||
optional bool accepted = 1; // true = client wants to download item
|
optional bool accepted = 1; // true = client wants to download item
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message RequestRateSong {
|
||||||
|
optional int32 rating = 1; // 0 to 5
|
||||||
|
}
|
||||||
|
|
||||||
// The message itself
|
// The message itself
|
||||||
message Message {
|
message Message {
|
||||||
optional int32 version = 1 [default=9];
|
optional int32 version = 1 [default=10];
|
||||||
optional MsgType type = 2 [default=UNKNOWN]; // What data is in the message?
|
optional MsgType type = 2 [default=UNKNOWN]; // What data is in the message?
|
||||||
|
|
||||||
optional RequestConnect request_connect = 21;
|
optional RequestConnect request_connect = 21;
|
||||||
@ -284,6 +289,7 @@ message Message {
|
|||||||
optional RequestOpenPlaylist request_open_playlist = 28;
|
optional RequestOpenPlaylist request_open_playlist = 28;
|
||||||
optional RequestClosePlaylist request_close_playlist = 29;
|
optional RequestClosePlaylist request_close_playlist = 29;
|
||||||
optional RequestDownloadSongs request_download_songs = 31;
|
optional RequestDownloadSongs request_download_songs = 31;
|
||||||
|
optional RequestRateSong request_rate_song = 35;
|
||||||
|
|
||||||
optional Repeat repeat = 13;
|
optional Repeat repeat = 13;
|
||||||
optional Shuffle shuffle = 14;
|
optional Shuffle shuffle = 14;
|
||||||
|
@ -77,6 +77,9 @@ IncomingDataParser::IncomingDataParser(Application* app)
|
|||||||
connect(this, SIGNAL(Close(int)),
|
connect(this, SIGNAL(Close(int)),
|
||||||
app_->playlist_manager(), SLOT(Close(int)));
|
app_->playlist_manager(), SLOT(Close(int)));
|
||||||
|
|
||||||
|
connect(this, SIGNAL(RateCurrentSong(int)),
|
||||||
|
app_->playlist_manager(), SLOT(RateCurrentSong(int)));
|
||||||
|
|
||||||
#ifdef HAVE_LIBLASTFM
|
#ifdef HAVE_LIBLASTFM
|
||||||
connect(this, SIGNAL(Love()),
|
connect(this, SIGNAL(Love()),
|
||||||
InternetModel::Service<LastFMService>(), SLOT(Love()));
|
InternetModel::Service<LastFMService>(), SLOT(Love()));
|
||||||
@ -180,6 +183,9 @@ void IncomingDataParser::Parse(const pb::remote::Message& msg) {
|
|||||||
case pb::remote::GET_LIBRARY:
|
case pb::remote::GET_LIBRARY:
|
||||||
emit SendLibrary(client);
|
emit SendLibrary(client);
|
||||||
break;
|
break;
|
||||||
|
case pb::remote::RATE_SONG:
|
||||||
|
RateSong(msg);
|
||||||
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,3 +298,13 @@ void IncomingDataParser::OpenPlaylist(const pb::remote::Message &msg) {
|
|||||||
void IncomingDataParser::ClosePlaylist(const pb::remote::Message &msg) {
|
void IncomingDataParser::ClosePlaylist(const pb::remote::Message &msg) {
|
||||||
emit Close(msg.request_close_playlist().playlist_id());
|
emit Close(msg.request_close_playlist().playlist_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IncomingDataParser::RateSong(const pb::remote::Message &msg) {
|
||||||
|
int rating = msg.request_rate_song().rating();
|
||||||
|
|
||||||
|
// Rating is from 0 to 5
|
||||||
|
if (rating > 5) rating = 5;
|
||||||
|
if (rating < 0) rating = 0;
|
||||||
|
|
||||||
|
emit RateCurrentSong(rating);
|
||||||
|
}
|
||||||
|
@ -48,6 +48,7 @@ signals:
|
|||||||
void SendSongs(const pb::remote::RequestDownloadSongs& request, RemoteClient* client);
|
void SendSongs(const pb::remote::RequestDownloadSongs& request, RemoteClient* client);
|
||||||
void ResponseSongOffer(RemoteClient* client, bool accepted);
|
void ResponseSongOffer(RemoteClient* client, bool accepted);
|
||||||
void SendLibrary(RemoteClient* client);
|
void SendLibrary(RemoteClient* client);
|
||||||
|
void RateCurrentSong(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Application* app_;
|
Application* app_;
|
||||||
@ -63,6 +64,7 @@ private:
|
|||||||
void SendPlaylists(const pb::remote::Message& msg);
|
void SendPlaylists(const pb::remote::Message& msg);
|
||||||
void OpenPlaylist(const pb::remote::Message& msg);
|
void OpenPlaylist(const pb::remote::Message& msg);
|
||||||
void ClosePlaylist(const pb::remote::Message& msg);
|
void ClosePlaylist(const pb::remote::Message& msg);
|
||||||
|
void RateSong(const pb::remote::Message& msg);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCOMINGDATAPARSER_H
|
#endif // INCOMINGDATAPARSER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user