SpotifyRequest: Limit returned albums to queried artists
This commit is contained in:
parent
1c4d3aebad
commit
826fad1ad4
|
@ -728,15 +728,25 @@ void SpotifyRequest::AlbumsReceived(QNetworkReply *reply, const Artist &artist_a
|
||||||
|
|
||||||
if (obj_item.contains(QLatin1String("artists")) && obj_item[QLatin1String("artists")].isArray()) {
|
if (obj_item.contains(QLatin1String("artists")) && obj_item[QLatin1String("artists")].isArray()) {
|
||||||
QJsonArray array_artists = obj_item[QLatin1String("artists")].toArray();
|
QJsonArray array_artists = obj_item[QLatin1String("artists")].toArray();
|
||||||
|
bool artist_matches = false;
|
||||||
for (const QJsonValueRef value : array_artists) {
|
for (const QJsonValueRef value : array_artists) {
|
||||||
if (!value.isObject()) {
|
if (!value.isObject()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QJsonObject obj_artist = value.toObject();
|
QJsonObject obj_artist = value.toObject();
|
||||||
if (obj_artist.isEmpty() || !obj_artist.contains(QLatin1String("id")) || !obj_artist.contains(QLatin1String("name"))) continue;
|
if (obj_artist.isEmpty() || !obj_artist.contains(QLatin1String("id")) || !obj_artist.contains(QLatin1String("name"))) continue;
|
||||||
artist.artist_id = obj_artist[QLatin1String("id")].toString();
|
if (artist.artist_id.isEmpty() || artist.artist_id == artist_artist.artist_id) {
|
||||||
artist.artist = obj_artist[QLatin1String("name")].toString();
|
artist.artist_id = obj_artist[QLatin1String("id")].toString();
|
||||||
break;
|
artist.artist = obj_artist[QLatin1String("name")].toString();
|
||||||
|
if (artist.artist_id == artist_artist.artist_id) {
|
||||||
|
artist_matches = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!artist_matches && (type_ == Type::FavouriteArtists || type_ == Type::SearchArtists)) {
|
||||||
|
AlbumsFinishCheck(artist_artist);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue