diff --git a/src/spotify/artist.cpp b/src/spotify/artist.cpp index 4c9970927..45be63b5a 100644 --- a/src/spotify/artist.cpp +++ b/src/spotify/artist.cpp @@ -34,3 +34,14 @@ QVector Artist::albums(Spotify &spotify) albums.append(Album(item.toObject())); return albums; } + +QVector Artist::relatedArtists(Spotify &spotify) +{ + auto json = spotify.get(QString("artists/%1/related-artists").arg(id)); + auto items = json["artists"].toArray(); + QVector artists; + artists.reserve(items.size()); + for (auto item : items) + artists.append(Artist(item.toObject())); + return artists; +} diff --git a/src/spotify/artist.hpp b/src/spotify/artist.hpp index 5c971e80a..9fe8c4219 100644 --- a/src/spotify/artist.hpp +++ b/src/spotify/artist.hpp @@ -23,5 +23,6 @@ namespace spt QString id, name, image; QVector topTracks(Spotify &spotify); QVector albums(Spotify &spotify); + QVector relatedArtists(Spotify &spotify); }; } \ No newline at end of file