This should fix the issue, that the coverart is not transfered on windows.
This commit is contained in:
parent
139777cace
commit
e9fd09193c
|
@ -147,7 +147,7 @@ void OutgoingDataCreator::CurrentSongChanged(const Song& song, const QString& ur
|
||||||
// If there is no song, create an empty node, otherwise fill it with data
|
// If there is no song, create an empty node, otherwise fill it with data
|
||||||
int i = app_->playlist_manager()->active()->current_row();
|
int i = app_->playlist_manager()->active()->current_row();
|
||||||
CreateSong(
|
CreateSong(
|
||||||
current_song_, uri, i,
|
current_song_, img, i,
|
||||||
msg.mutable_response_current_metadata()->mutable_song_metadata());
|
msg.mutable_response_current_metadata()->mutable_song_metadata());
|
||||||
|
|
||||||
SendDataToClients(&msg);
|
SendDataToClients(&msg);
|
||||||
|
@ -156,7 +156,7 @@ void OutgoingDataCreator::CurrentSongChanged(const Song& song, const QString& ur
|
||||||
|
|
||||||
void OutgoingDataCreator::CreateSong(
|
void OutgoingDataCreator::CreateSong(
|
||||||
const Song& song,
|
const Song& song,
|
||||||
const QString& art_uri,
|
const QImage& art,
|
||||||
const int index,
|
const int index,
|
||||||
pb::remote::SongMetadata* song_metadata) {
|
pb::remote::SongMetadata* song_metadata) {
|
||||||
if (song.is_valid()) {
|
if (song.is_valid()) {
|
||||||
|
@ -174,14 +174,13 @@ void OutgoingDataCreator::CreateSong(
|
||||||
song_metadata->set_playcount(song.playcount());
|
song_metadata->set_playcount(song.playcount());
|
||||||
|
|
||||||
// Append coverart
|
// Append coverart
|
||||||
if (!art_uri.isEmpty()) {
|
if (!art.isNull()) {
|
||||||
QImage orig(QUrl(art_uri).toLocalFile());
|
|
||||||
QImage small;
|
QImage small;
|
||||||
// Check if we resize the image
|
// Check if we resize the image
|
||||||
if (orig.width() > 1000) {
|
if (art.width() > 1000) {
|
||||||
small = orig.scaled(1000, 1000, Qt::KeepAspectRatio);
|
small = art.scaled(1000, 1000, Qt::KeepAspectRatio);
|
||||||
} else {
|
} else {
|
||||||
small = orig;
|
small = art;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the image in a buffer and compress it
|
// Read the image in a buffer and compress it
|
||||||
|
@ -230,11 +229,11 @@ void OutgoingDataCreator::SendPlaylistSongs(int id) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
SongList song_list = playlist->GetAllSongs();
|
SongList song_list = playlist->GetAllSongs();
|
||||||
QListIterator<Song> it(song_list);
|
QListIterator<Song> it(song_list);
|
||||||
|
QImage null_img;
|
||||||
while(it.hasNext()) {
|
while(it.hasNext()) {
|
||||||
Song song = it.next();
|
Song song = it.next();
|
||||||
QString art = song.art_automatic();
|
|
||||||
pb::remote::SongMetadata* pb_song = pb_response_playlist_songs->add_songs();
|
pb::remote::SongMetadata* pb_song = pb_response_playlist_songs->add_songs();
|
||||||
CreateSong(song, art, index, pb_song);
|
CreateSong(song, null_img, index, pb_song);
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
SendDataToClients(&msg);
|
SendDataToClients(&msg);
|
||||||
|
|
|
@ -51,7 +51,7 @@ private:
|
||||||
void SetEngineState(pb::remote::ResponseClementineInfo* msg);
|
void SetEngineState(pb::remote::ResponseClementineInfo* msg);
|
||||||
void CreateSong(
|
void CreateSong(
|
||||||
const Song& song,
|
const Song& song,
|
||||||
const QString& art_uri,
|
const QImage& art,
|
||||||
const int index,
|
const int index,
|
||||||
pb::remote::SongMetadata* song_metadata);
|
pb::remote::SongMetadata* song_metadata);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue