feat: restore most-popular search and top results badges
Some checks failed
Build for Windows / build-windows (push) Has been cancelled

This commit is contained in:
joren
2026-03-30 22:53:41 +02:00
parent 3346b424b3
commit 2da934f3f6
7 changed files with 134 additions and 1 deletions

View File

@@ -45,6 +45,7 @@ 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;
pub const EV_DEEP_SHUFFLE_OK: c_int = 25;
pub const EV_MOST_POPULAR_OK: c_int = 26;
pub const EV_GENRES_OK: c_int = 27;
pub const EV_FEATURED_ALBUMS_OK: c_int = 28;
@@ -203,6 +204,36 @@ pub unsafe extern "C" fn qobuz_backend_search(
});
}
#[no_mangle]
pub unsafe extern "C" fn qobuz_backend_most_popular_search(
ptr: *mut Backend,
query: *const c_char,
limit: u32,
) {
let inner = &(*ptr).0;
let query = CStr::from_ptr(query).to_string_lossy().into_owned();
let client = inner.client.clone();
let cb = inner.cb;
let ud = inner.ud;
spawn(inner, async move {
let result = client
.lock()
.await
.get_most_popular(&query, 0, limit)
.await;
match result {
Ok(r) => call_cb(
cb,
ud,
EV_MOST_POPULAR_OK,
&serde_json::to_string(&r).unwrap_or_default(),
),
Err(e) => call_cb(cb, ud, EV_SEARCH_ERR, &err_json(&e.to_string())),
}
});
}
// ---------- Album ----------
#[no_mangle]