From d912bd128440eb19dd8b315d47296dcb6ecd9f2f Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Tue, 10 Feb 2026 01:43:49 -0600 Subject: [PATCH] feat: add genre_ids support to discover playlists endpoint --- src-tauri/src/api/client.rs | 13 +++++++++++-- src-tauri/src/commands/search.rs | 7 ++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src-tauri/src/api/client.rs b/src-tauri/src/api/client.rs index bb89a6dcc..b31c2ba48 100644 --- a/src-tauri/src/api/client.rs +++ b/src-tauri/src/api/client.rs @@ -583,11 +583,12 @@ impl QobuzClient { Ok(serde_json::from_value(response)?) } - /// Get discover playlists with optional tag filter - /// Example: tags=label, tags=partner + /// Get discover playlists with optional tag and genre filters + /// Example: tags=label, genre_ids=112,119 pub async fn get_discover_playlists( &self, tag: Option, + genre_ids: Option>, limit: Option, offset: Option, ) -> Result { @@ -599,6 +600,14 @@ impl QobuzClient { query.push(("tags", t.clone())); } + // Add genre_ids as comma-separated list if provided + if let Some(gids) = genre_ids { + if !gids.is_empty() { + let ids_str = gids.iter().map(|id| id.to_string()).collect::>().join(","); + query.push(("genre_ids", ids_str)); + } + } + // Add limit (default 20) let lim = limit.unwrap_or(20); query.push(("limit", lim.to_string())); diff --git a/src-tauri/src/commands/search.rs b/src-tauri/src/commands/search.rs index abc43e44d..7b5120e1e 100644 --- a/src-tauri/src/commands/search.rs +++ b/src-tauri/src/commands/search.rs @@ -676,19 +676,20 @@ pub async fn get_discover_index( Ok(result) } -/// Get discover playlists with optional tag filter +/// Get discover playlists with optional tag and genre filters #[tauri::command] pub async fn get_discover_playlists( tag: Option, + genre_ids: Option>, limit: Option, offset: Option, state: State<'_, AppState>, ) -> Result { - log::debug!("Command: get_discover_playlists tag={:?} limit={:?} offset={:?}", tag, limit, offset); + log::debug!("Command: get_discover_playlists tag={:?} genre_ids={:?} limit={:?} offset={:?}", tag, genre_ids, limit, offset); let client = state.client.read().await; client - .get_discover_playlists(tag, limit, offset) + .get_discover_playlists(tag, genre_ids, limit, offset) .await .map_err(|e| e.to_string()) }