diff --git a/src-tauri/src/commands_v2/playlists.rs b/src-tauri/src/commands_v2/playlists.rs index cd2fd625d..94b0db3a9 100644 --- a/src-tauri/src/commands_v2/playlists.rs +++ b/src-tauri/src/commands_v2/playlists.rs @@ -327,9 +327,14 @@ pub async fn v2_playlist_get_custom_order( .manager() .check_requirements(CommandRequirement::RequiresUserSession) .await?; - crate::library::playlist_get_custom_order(playlistId, library_state) - .await - .map_err(RuntimeError::Internal) + log::info!("Command: playlist_get_custom_order {}", playlistId); + + let guard__ = library_state.db.lock().await; + let db = guard__ + .as_ref() + .ok_or_else(|| RuntimeError::Internal("No active session - please log in".to_string()))?; + db.get_playlist_custom_order(playlistId) + .map_err(|e| RuntimeError::Internal(e.to_string())) } #[tauri::command] @@ -343,9 +348,14 @@ pub async fn v2_playlist_has_custom_order( .manager() .check_requirements(CommandRequirement::RequiresUserSession) .await?; - crate::library::playlist_has_custom_order(playlistId, library_state) - .await - .map_err(RuntimeError::Internal) + log::info!("Command: playlist_has_custom_order {}", playlistId); + + let guard__ = library_state.db.lock().await; + let db = guard__ + .as_ref() + .ok_or_else(|| RuntimeError::Internal("No active session - please log in".to_string()))?; + db.has_playlist_custom_order(playlistId) + .map_err(|e| RuntimeError::Internal(e.to_string())) } #[tauri::command] @@ -359,9 +369,17 @@ pub async fn v2_playlist_get_tracks_with_local_copies( .manager() .check_requirements(CommandRequirement::RequiresUserSession) .await?; - crate::library::playlist_get_tracks_with_local_copies(trackIds, library_state) - .await - .map_err(RuntimeError::Internal) + + let guard__ = library_state.db.lock().await; + let db = guard__ + .as_ref() + .ok_or_else(|| RuntimeError::Internal("No active session - please log in".to_string()))?; + + let local_ids = db + .get_tracks_with_local_copies(&trackIds) + .map_err(|e| RuntimeError::Internal(e.to_string()))?; + + Ok(local_ids.into_iter().collect()) } /// Search playlists (V2 - uses QbzCore) diff --git a/src-tauri/src/library/commands.rs b/src-tauri/src/library/commands.rs index e0058e8db..80b9b1ee9 100644 --- a/src-tauri/src/library/commands.rs +++ b/src-tauri/src/library/commands.rs @@ -747,23 +747,6 @@ pub async fn playlist_increment_play_count( // === Playlist Custom Track Order === -/// Get custom track order for a playlist -/// Returns Vec of (track_id, is_local, position) -#[tauri::command] -pub async fn playlist_get_custom_order( - playlist_id: u64, - state: State<'_, LibraryState>, -) -> Result, String> { - log::info!("Command: playlist_get_custom_order {}", playlist_id); - - let guard__ = state.db.lock().await; - let db = guard__ - .as_ref() - .ok_or("No active session - please log in")?; - db.get_playlist_custom_order(playlist_id) - .map_err(|e| e.to_string()) -} - /// Initialize custom order for a playlist from current track arrangement #[tauri::command] pub async fn playlist_init_custom_order( @@ -830,22 +813,6 @@ pub async fn playlist_move_track( .map_err(|e| e.to_string()) } -/// Check if a playlist has custom order defined -#[tauri::command] -pub async fn playlist_has_custom_order( - playlist_id: u64, - state: State<'_, LibraryState>, -) -> Result { - log::info!("Command: playlist_has_custom_order {}", playlist_id); - - let guard__ = state.db.lock().await; - let db = guard__ - .as_ref() - .ok_or("No active session - please log in")?; - db.has_playlist_custom_order(playlist_id) - .map_err(|e| e.to_string()) -} - /// Clear custom order for a playlist #[tauri::command] pub async fn playlist_clear_custom_order( @@ -1289,25 +1256,6 @@ pub async fn playlist_get_local_track_id( .map_err(|e| e.to_string()) } -/// Batch check which tracks have local copies (for offline mode) -/// Returns a list of track IDs that have local versions -#[tauri::command] -pub async fn playlist_get_tracks_with_local_copies( - track_ids: Vec, - state: State<'_, LibraryState>, -) -> Result, String> { - let guard__ = state.db.lock().await; - let db = guard__ - .as_ref() - .ok_or("No active session - please log in")?; - - let local_ids = db - .get_tracks_with_local_copies(&track_ids) - .map_err(|e| e.to_string())?; - - Ok(local_ids.into_iter().collect()) -} - /// Get playlists that have local content (for offline mode filtering) #[tauri::command] pub async fn playlist_get_offline_available( diff --git a/src-tauri/src/library/mod.rs b/src-tauri/src/library/mod.rs index 6abfe82b0..fcfc9f3cd 100644 --- a/src-tauri/src/library/mod.rs +++ b/src-tauri/src/library/mod.rs @@ -85,9 +85,6 @@ pub use state::{ BackfillReport, CleanupResult, LibraryAlbumMetadataUpdateRequest, LibraryAlbumTrackMetadataUpdate, LibraryState, }; -pub use commands::{ - playlist_get_custom_order, playlist_get_tracks_with_local_copies, playlist_has_custom_order, -}; use std::path::Path; use std::sync::atomic::AtomicBool;