on xenial help sign in
Discard the last.fm fallback image.
1c2761aAntti Kaijanmäki
plugins/Utils/albumartprovider.cpp+10−4
@@ -148,7 +148,7 @@ std::string AlbumArtProvider::get_lastfm_url(const albuminfo &ai) {
148 loop.exec();
148 loop.exec();
149
149
150 if (reply->error() != QNetworkReply::NoError) {
150 if (reply->error() != QNetworkReply::NoError) {
151− qDebug() << "Error getting the XML:" << reply->errorString();
151+ qWarning() << "Error getting the XML:" << reply->errorString();
152 return "";
152 return "";
153 }
153 }
154
154
@@ -162,6 +162,12 @@ std::string AlbumArtProvider::get_lastfm_url(const albuminfo &ai) {
162 query.evaluateTo(&image);
162 query.evaluateTo(&image);
163 image = image.trimmed();
163 image = image.trimmed();
164
164
165+ // return empty if last.fm tries to offer their default
166+ // fallback artwork
167+ if (image.contains("catalogue/noimage")) {
168+ return "";
169+ }
170+
165 return image.toStdString();
171 return image.toStdString();
166}
172}
167
173
@@ -176,17 +182,17 @@ bool AlbumArtProvider::download_and_store(const std::string &image_url, const st
176 loop.exec();
182 loop.exec();
177
183
178 if (reply->error() != QNetworkReply::NoError) {
184 if (reply->error() != QNetworkReply::NoError) {
179− qDebug() << "Error getting the image:" << reply->errorString();
185+ qWarning() << "Error getting the image:" << reply->errorString();
180 return false;
186 return false;
181 }
187 }
182
188
183 QFile file(fileName);
189 QFile file(fileName);
184 if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
190 if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
185− qDebug() << "Could not open file for writing:" << file.errorString();
191+ qWarning() << "Could not open file for writing:" << file.errorString();
186 return false;
192 return false;
187 }
193 }
188 if (file.write(reply->readAll()) == -1){
194 if (file.write(reply->readAll()) == -1){
189− qDebug() << "Could not write the image:" << file.error();
195+ qWarning() << "Could not write the image:" << file.error();
190 return false;
196 return false;
191 }
197 }
192
198