on xenial help sign in
Merged Wellark's branch.
90cc6b8Pawel Stolowski
plugins/Utils/albumartprovider.cpp+10−4
@@ -68,7 +68,7 @@ std::string AlbumArtProvider::get_lastfm_url(const albuminfo &ai) {
68 loop.exec();
68 loop.exec();
69
69
70 if (reply->error() != QNetworkReply::NoError) {
70 if (reply->error() != QNetworkReply::NoError) {
71− qDebug() << "Error getting the XML:" << reply->errorString();
71+ qWarning() << "Error getting the XML:" << reply->errorString();
72 return "";
72 return "";
73 }
73 }
74
74
@@ -82,6 +82,12 @@ std::string AlbumArtProvider::get_lastfm_url(const albuminfo &ai) {
82 query.evaluateTo(&image);
82 query.evaluateTo(&image);
83 image = image.trimmed();
83 image = image.trimmed();
84
84
85+ // return empty if last.fm tries to offer their default
86+ // fallback artwork
87+ if (image.contains("catalogue/noimage")) {
88+ return "";
89+ }
90+
85 return image.toStdString();
91 return image.toStdString();
86}
92}
87
93
@@ -96,17 +102,17 @@ bool AlbumArtProvider::download_and_store(const std::string &image_url, const st
96 loop.exec();
102 loop.exec();
97
103
98 if (reply->error() != QNetworkReply::NoError) {
104 if (reply->error() != QNetworkReply::NoError) {
99− qDebug() << "Error getting the image:" << reply->errorString();
105+ qWarning() << "Error getting the image:" << reply->errorString();
100 return false;
106 return false;
101 }
107 }
102
108
103 QFile file(fileName);
109 QFile file(fileName);
104 if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
110 if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
105− qDebug() << "Could not open file for writing:" << file.errorString();
111+ qWarning() << "Could not open file for writing:" << file.errorString();
106 return false;
112 return false;
107 }
113 }
108 if (file.write(reply->readAll()) == -1){
114 if (file.write(reply->readAll()) == -1){
109− qDebug() << "Could not write the image:" << file.error();
115+ qWarning() << "Could not write the image:" << file.error();
110 return false;
116 return false;
111 }
117 }
112
118