feat: full artist release list via artist/getReleasesList
Instead of relying on the limited preview in artist/page, fire a separate artist/getReleasesList request per release type (album, epSingle, live, compilation) in parallel when loading an artist. Each result updates its section independently as it arrives, so the page populates progressively without a single large request. Also fixes the artist name in the status bar (was reading wrong field). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -195,32 +195,29 @@ void ArtistView::setArtist(const QJsonObject &artist)
|
||||
m_topTracks->loadTracks(topTracks);
|
||||
m_topTracksSection->setVisible(!topTracks.isEmpty());
|
||||
|
||||
// releases is an array of {type, has_more, items[]}
|
||||
const QJsonArray releases = artist["releases"].toArray();
|
||||
QJsonArray albums, eps, live, compilations;
|
||||
for (const QJsonValue &rv : releases) {
|
||||
const QJsonObject rg = rv.toObject();
|
||||
const QString type = rg["type"].toString();
|
||||
const QJsonArray items = rg["items"].toArray();
|
||||
if (type == QStringLiteral("album"))
|
||||
albums = items;
|
||||
else if (type == QStringLiteral("epSingle"))
|
||||
eps = items;
|
||||
else if (type == QStringLiteral("live"))
|
||||
live = items;
|
||||
else if (type == QStringLiteral("compilation"))
|
||||
compilations = items;
|
||||
}
|
||||
|
||||
m_secAlbums->setAlbums(albums);
|
||||
m_secEps->setAlbums(eps);
|
||||
m_secLive->setAlbums(live);
|
||||
m_secCompilations->setAlbums(compilations);
|
||||
// Release sections are populated asynchronously via setReleases().
|
||||
// Clear them now so stale data from a previous artist isn't shown.
|
||||
m_secAlbums->setAlbums({});
|
||||
m_secEps->setAlbums({});
|
||||
m_secLive->setAlbums({});
|
||||
m_secCompilations->setAlbums({});
|
||||
m_secOther->setAlbums({});
|
||||
|
||||
m_secAlbums->setVisible(!m_secAlbums->isEmpty());
|
||||
m_secEps->setVisible(!m_secEps->isEmpty());
|
||||
m_secLive->setVisible(!m_secLive->isEmpty());
|
||||
m_secCompilations->setVisible(!m_secCompilations->isEmpty());
|
||||
m_secAlbums->setVisible(false);
|
||||
m_secEps->setVisible(false);
|
||||
m_secLive->setVisible(false);
|
||||
m_secCompilations->setVisible(false);
|
||||
m_secOther->setVisible(false);
|
||||
}
|
||||
|
||||
void ArtistView::setReleases(const QString &releaseType, const QJsonArray &items)
|
||||
{
|
||||
ArtistSection *sec = nullptr;
|
||||
if (releaseType == QStringLiteral("album")) sec = m_secAlbums;
|
||||
else if (releaseType == QStringLiteral("epSingle")) sec = m_secEps;
|
||||
else if (releaseType == QStringLiteral("live")) sec = m_secLive;
|
||||
else if (releaseType == QStringLiteral("compilation")) sec = m_secCompilations;
|
||||
else sec = m_secOther;
|
||||
|
||||
sec->setAlbums(items);
|
||||
sec->setVisible(!sec->isEmpty());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user