refactor(discover): read Release Watch from /discover/index response
The initial implementation added a dedicated get_release_watch client method calling /albums/releaseWatch, but that path is only routed on the mobile API; the web API (api.json/0.2) that qbz-qobuz speaks to returned 'no Service found with those values'. The correct source is already available: /discover/index — which we were already calling for newReleases/pressAwards/qobuzissimes/etc — also returns a release_watch container when the user has follows. We were silently dropping it because DiscoverContainers didn't declare the field. Now: - DiscoverContainers (Rust + TS mirror) declares the release_watch field with a serde alias that accepts both camelCase and snake_case spellings, so future naming churn upstream is tolerated - HomeView reads it in fetchAllDiscoverData next to the other editorial sections (one less network round-trip) - ForYouTab calls v2_get_discover_index and extracts only the release_watch container - Reverted the custom /albums/releaseWatch endpoint, client method, core passthrough, bridge wrapper and v2_get_release_watch command Section identity (homeSettingsStore id, i18n keys, render blocks) is unchanged. cc
This commit is contained in:
10 files changed
+48
-196
No files matched your search
@@ -258,50 +258,6 @@ pub async fn v2_get_featured_albums(
|
||||
Ok(results)
|
||||
}
|
||||
|
||||
/// Get Release Watch (V2 — releases from followed artists, labels and awards)
|
||||
///
|
||||
/// Surfaces the mobile client's "Radar de Novedades" / "Release Watch" feed.
|
||||
/// Filtered through the user's artist blacklist like other album results.
|
||||
#[tauri::command]
|
||||
#[allow(non_snake_case)]
|
||||
pub async fn v2_get_release_watch(
|
||||
limit: Option<u32>,
|
||||
offset: Option<u32>,
|
||||
bridge: State<'_, CoreBridgeState>,
|
||||
blacklist_state: State<'_, BlacklistState>,
|
||||
runtime: State<'_, RuntimeManagerState>,
|
||||
) -> Result<SearchResultsPage<Album>, RuntimeError> {
|
||||
runtime
|
||||
.manager()
|
||||
.check_requirements(CommandRequirement::RequiresCoreBridgeAuth)
|
||||
.await?;
|
||||
|
||||
let limit = limit.unwrap_or(20);
|
||||
let offset = offset.unwrap_or(0);
|
||||
log::info!("[V2] get_release_watch: limit={}, offset={}", limit, offset);
|
||||
|
||||
let bridge = bridge.get().await;
|
||||
let mut results = bridge
|
||||
.get_release_watch(limit, offset)
|
||||
.await
|
||||
.map_err(RuntimeError::Internal)?;
|
||||
|
||||
let original_count = results.items.len();
|
||||
results
|
||||
.items
|
||||
.retain(|album| !blacklist_state.is_blacklisted(album.artist.id));
|
||||
let filtered_count = original_count - results.items.len();
|
||||
if filtered_count > 0 {
|
||||
log::debug!(
|
||||
"[V2/Blacklist] Filtered {} albums from release watch",
|
||||
filtered_count
|
||||
);
|
||||
results.total = results.total.saturating_sub(filtered_count as u32);
|
||||
}
|
||||
|
||||
Ok(results)
|
||||
}
|
||||
|
||||
/// Get artist page (V2 - uses QbzCore)
|
||||
#[tauri::command]
|
||||
#[allow(non_snake_case)]
|
||||
|
||||
@@ -498,20 +498,6 @@ impl CoreBridge {
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
/// Get Release Watch — releases from artists, labels, and awards the user
|
||||
/// follows. Surfaces the Qobuz "Radar de Novedades" / "Release Watch"
|
||||
/// feed used in the official mobile client's Discover screens.
|
||||
pub async fn get_release_watch(
|
||||
&self,
|
||||
limit: u32,
|
||||
offset: u32,
|
||||
) -> Result<SearchResultsPage<Album>, String> {
|
||||
self.core
|
||||
.get_release_watch(limit, offset)
|
||||
.await
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
/// Get artist page (full artist details with albums, tracks, similar)
|
||||
pub async fn get_artist_page(
|
||||
&self,
|
||||
|
||||
@@ -1594,7 +1594,6 @@ pub fn run() {
|
||||
commands_v2::v2_get_playlist_tags,
|
||||
commands_v2::v2_get_discover_albums,
|
||||
commands_v2::v2_get_featured_albums,
|
||||
commands_v2::v2_get_release_watch,
|
||||
commands_v2::v2_get_artist_page,
|
||||
commands_v2::v2_get_similar_artists,
|
||||
commands_v2::v2_get_artist_with_albums,
|
||||
|
||||
Reference in new issue
Block a user