feat: most-popular search as default Top Results tab

Add /most-popular/get endpoint support (discovered via Burp):
- Returns mixed artists/albums/tracks ordered by popularity for a query
- New 'Top Results' tab shown first/default in the search panel
- Badge column: A (artist, blue), H (hi-res album, gold), A (album, gray), T (track, green)
- Full context menu support on all item types in the new tab
- Both most-popular and regular search fire on submit in parallel

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
joren
2026-03-30 20:28:13 +02:00
parent 70810bd4b1
commit 200ef39d04
7 changed files with 216 additions and 10 deletions

View File

@@ -70,6 +70,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;
// ---------- Callback ----------
@@ -222,6 +223,28 @@ 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.most_popular_search(&query, limit).await;
let (ev, json) = match result {
Ok(r) => (EV_MOST_POPULAR_OK, serde_json::to_string(&r).unwrap_or_default()),
Err(e) => (EV_GENERIC_ERR, err_json(&e.to_string())),
};
call_cb(cb, ud, ev, &json);
});
}
// ---------- Album ----------
#[no_mangle]