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:
joren
2026-03-25 13:53:57 +01:00
parent 6f11b364aa
commit 5ae18afa08
10 changed files with 107 additions and 27 deletions

View File

@@ -68,6 +68,7 @@ pub const EV_POSITION: c_int = 16;
pub const EV_TRACK_URL_OK: c_int = 17;
pub const EV_TRACK_URL_ERR: c_int = 18;
pub const EV_GENERIC_ERR: c_int = 19;
pub const EV_ARTIST_RELEASES_OK: c_int = 24;
// ---------- Callback ----------
@@ -256,6 +257,38 @@ pub unsafe extern "C" fn qobuz_backend_get_artist(ptr: *mut Backend, artist_id:
});
}
// ---------- Artist releases ----------
#[no_mangle]
pub unsafe extern "C" fn qobuz_backend_get_artist_releases(
ptr: *mut Backend,
artist_id: i64,
release_type: *const c_char,
limit: u32,
offset: u32,
) {
let inner = &(*ptr).0;
let client = inner.client.clone();
let cb = inner.cb; let ud = inner.ud;
let rtype = CStr::from_ptr(release_type).to_string_lossy().into_owned();
spawn(inner, async move {
let result = client.lock().await
.get_artist_releases_list(artist_id, &rtype, limit, offset)
.await;
let (ev, json) = match result {
Ok(r) => {
// Wrap with the release_type so Qt can route to the right section
let mut obj = r.as_object().cloned().unwrap_or_default();
obj.insert("release_type".to_string(), serde_json::Value::String(rtype));
(EV_ARTIST_RELEASES_OK, serde_json::to_string(&obj).unwrap_or_default())
}
Err(e) => (EV_GENERIC_ERR, err_json(&e.to_string())),
};
call_cb(cb, ud, ev, &json);
});
}
// ---------- Playlist ----------
#[no_mangle]