Add Download functionality to all Qobuz track context menus
- Created open_track_folder Rust command to open folder containing downloaded track - Added frontend wrappers: openTrackFolder and reDownloadTrack in downloadState.ts - Updated all Qobuz views to support Download submenu: - HomeView: Added track download props and handlers - AlbumDetailView: Added onTrackOpenFolder and onTrackReDownload - SearchView: Added track download actions to both TrackMenu usages - FavoritesView: Added download submenu to both track list variants - Downloaded tracks now show submenu with 'Open containing folder' and 'Re-download' options - Completes Phase 2 Task 2.1: Context Menu Homogenization (Download)
This commit is contained in:
1 parent
4ed2b4c2ab
commit
ebca7c0546
7 files changed
+109
-5
No files matched your search
@@ -479,6 +479,35 @@ pub async fn open_album_folder(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Open the folder containing a specific track in the system file manager
|
||||
#[tauri::command]
|
||||
pub async fn open_track_folder(
|
||||
track_id: u64,
|
||||
cache_state: State<'_, DownloadCacheState>,
|
||||
) -> Result<(), String> {
|
||||
log::info!("Command: open_track_folder for track_id: {}", track_id);
|
||||
|
||||
let db = cache_state.db.lock().await;
|
||||
|
||||
// Get the track's file path
|
||||
let file_path = db.get_file_path(track_id)?
|
||||
.ok_or_else(|| "Track file path not found - track may not be downloaded".to_string())?;
|
||||
|
||||
let track_path = std::path::Path::new(&file_path);
|
||||
let track_dir = track_path
|
||||
.parent()
|
||||
.ok_or_else(|| "Could not determine track folder".to_string())?;
|
||||
|
||||
if !track_dir.exists() {
|
||||
return Err("Track folder does not exist".to_string());
|
||||
}
|
||||
|
||||
// Open with system file manager
|
||||
open::that(track_dir).map_err(|e| format!("Failed to open folder: {}", e))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Check if an album is fully downloaded (all tracks ready)
|
||||
#[tauri::command]
|
||||
pub async fn check_album_fully_downloaded(
|
||||
|
||||
@@ -539,6 +539,7 @@ pub fn run() {
|
||||
download_cache::commands::set_download_cache_limit,
|
||||
download_cache::commands::open_download_cache_folder,
|
||||
download_cache::commands::open_album_folder,
|
||||
download_cache::commands::open_track_folder,
|
||||
download_cache::commands::check_album_fully_downloaded,
|
||||
download_cache::commands::check_download_root_mounted,
|
||||
download_cache::commands::validate_download_path,
|
||||
|
||||
Reference in new issue
Block a user