Improve cover providers score system

This commit is contained in:
Jonas Kvinge
2019-04-17 22:18:03 +02:00
parent ca928bdacb
commit 63d5018ad6
14 changed files with 190 additions and 66 deletions

View File

@@ -48,7 +48,7 @@ const char *LastFmCoverProvider::kUrl = "https://ws.audioscrobbler.com/2.0/";
const char *LastFmCoverProvider::kApiKey = "211990b4c96782c05d1536e7219eb56e";
const char *LastFmCoverProvider::kSecret = "80fd738f49596e9709b1bf9319c444a8";
LastFmCoverProvider::LastFmCoverProvider(Application *app, QObject *parent) : CoverProvider("last.fm", true, app, parent), network_(new NetworkAccessManager(this)) {}
LastFmCoverProvider::LastFmCoverProvider(Application *app, QObject *parent) : CoverProvider("last.fm", 1.0, true, app, parent), network_(new NetworkAccessManager(this)) {}
bool LastFmCoverProvider::StartSearch(const QString &artist, const QString &album, int id) {
@@ -156,8 +156,8 @@ void LastFmCoverProvider::QueryFinished(QNetworkReply *reply, int id) {
continue;
}
QString artist = json_obj["artist"].toString();
QString name = json_obj["name"].toString();
QString album = json_obj["name"].toString();
QJsonValue json_image = json_obj["image"];
if (!json_image.isArray()) {
Error("Invalid Json reply, album image is not an array.", json_image);
@@ -187,7 +187,8 @@ void LastFmCoverProvider::QueryFinished(QNetworkReply *reply, int id) {
if (url.isEmpty()) continue;
CoverSearchResult cover_result;
cover_result.description = artist + " " + name;
cover_result.artist = artist;
cover_result.album = album;
cover_result.image_url = url;
results << cover_result;
}