Use format only when available
This commit is contained in:
@@ -1249,12 +1249,9 @@ void QobuzRequest::AlbumCoverReceived(QNetworkReply *reply, const QUrl &cover_ur
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<QByteArray> format_list = Utilities::ImageFormatsForMimeType(mimetype.toUtf8());
|
QList<QByteArray> format_list = Utilities::ImageFormatsForMimeType(mimetype.toUtf8());
|
||||||
QByteArray format;
|
char *format = nullptr;
|
||||||
if (format_list.isEmpty()) {
|
if (!format_list.isEmpty()) {
|
||||||
format = "JPG";
|
format = format_list.first().data();
|
||||||
}
|
|
||||||
else {
|
|
||||||
format = format_list.first();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage image;
|
QImage image;
|
||||||
|
|||||||
@@ -803,9 +803,15 @@ void SubsonicRequest::AlbumCoverReceived(QNetworkReply *reply, const QUrl url, c
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<QByteArray> format_list = Utilities::ImageFormatsForMimeType(mimetype.toUtf8());
|
||||||
|
char *format = nullptr;
|
||||||
|
if (!format_list.isEmpty()) {
|
||||||
|
format = format_list.first().data();
|
||||||
|
}
|
||||||
|
|
||||||
QImage image;
|
QImage image;
|
||||||
if (image.loadFromData(data)) {
|
if (image.loadFromData(data, format)) {
|
||||||
if (image.save(filename, "JPG")) {
|
if (image.save(filename, format)) {
|
||||||
while (album_covers_requests_sent_.contains(url)) {
|
while (album_covers_requests_sent_.contains(url)) {
|
||||||
Song *song = album_covers_requests_sent_.take(url);
|
Song *song = album_covers_requests_sent_.take(url);
|
||||||
song->set_art_automatic(QUrl::fromLocalFile(filename));
|
song->set_art_automatic(QUrl::fromLocalFile(filename));
|
||||||
|
|||||||
@@ -1186,12 +1186,9 @@ void TidalRequest::AlbumCoverReceived(QNetworkReply *reply, const QString &album
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<QByteArray> format_list = Utilities::ImageFormatsForMimeType(mimetype.toUtf8());
|
QList<QByteArray> format_list = Utilities::ImageFormatsForMimeType(mimetype.toUtf8());
|
||||||
QByteArray format;
|
char *format = nullptr;
|
||||||
if (format_list.isEmpty()) {
|
if (!format_list.isEmpty()) {
|
||||||
format = "JPG";
|
format = format_list.first().data();
|
||||||
}
|
|
||||||
else {
|
|
||||||
format = format_list.first();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage image;
|
QImage image;
|
||||||
|
|||||||
Reference in New Issue
Block a user