mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-18 12:28:31 +01:00
- Do not send cover arts on file download chunks.
- Set the version in the send function, not in each function that creates a protocol buffer message.
This commit is contained in:
parent
4fe293b6d0
commit
662b635d96
@ -135,9 +135,6 @@ void OutgoingDataCreator::SendDataToClients(pb::remote::Message* msg) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send the default version
|
||||
msg->set_version(msg->default_instance().version());
|
||||
|
||||
RemoteClient* client;
|
||||
foreach(client, *clients_) {
|
||||
// Do not send data to downloaders
|
||||
@ -595,11 +592,10 @@ void OutgoingDataCreator::OfferNextSong(RemoteClient *client) {
|
||||
chunk->set_file_count(item.song_count_);
|
||||
chunk->set_file_number(item.song_no_);
|
||||
|
||||
CreateSong(item.song_, item.song_.image(), -1,
|
||||
CreateSong(item.song_, QImage() , -1,
|
||||
chunk->mutable_song_metadata());
|
||||
}
|
||||
|
||||
msg.set_version(msg.default_instance().version());
|
||||
client->SendData(&msg);
|
||||
}
|
||||
|
||||
@ -638,6 +634,8 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song,
|
||||
pb::remote::ResponseSongFileChunk* chunk = msg.mutable_response_song_file_chunk();
|
||||
msg.set_type(pb::remote::SONG_FILE_CHUNK);
|
||||
|
||||
QImage null_image;
|
||||
|
||||
while (!file.atEnd()) {
|
||||
// Read file chunk
|
||||
data = file.read(kFileChunkSize);
|
||||
@ -655,12 +653,11 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song,
|
||||
if (chunk_number == 1) {
|
||||
int i = app_->playlist_manager()->active()->current_row();
|
||||
CreateSong(
|
||||
song, song.image(), i,
|
||||
song, null_image, i,
|
||||
msg.mutable_response_song_file_chunk()->mutable_song_metadata());
|
||||
}
|
||||
|
||||
// Send data directly to the client
|
||||
msg.set_version(msg.default_instance().version());
|
||||
client->SendData(&msg);
|
||||
|
||||
// Clear working data
|
||||
|
@ -144,9 +144,6 @@ void RemoteClient::DisconnectClient(pb::remote::ReasonDisconnect reason) {
|
||||
pb::remote::Message msg;
|
||||
msg.set_type(pb::remote::DISCONNECT);
|
||||
|
||||
// Send the default version
|
||||
msg.set_version(msg.default_instance().version());
|
||||
|
||||
msg.mutable_response_disconnect()->set_reason_disconnect(reason);
|
||||
SendDataToClient(&msg);
|
||||
|
||||
@ -157,6 +154,9 @@ void RemoteClient::DisconnectClient(pb::remote::ReasonDisconnect reason) {
|
||||
|
||||
// Sends data to client without check if authenticated
|
||||
void RemoteClient::SendDataToClient(pb::remote::Message *msg) {
|
||||
// Set the default version
|
||||
msg->set_version(msg->default_instance().version());
|
||||
|
||||
// Check if we are still connected
|
||||
if (client_->state() == QTcpSocket::ConnectedState) {
|
||||
// Serialize the message
|
||||
|
Loading…
Reference in New Issue
Block a user