diff --git a/src/main.rs b/src/main.rs index 043a56c..282a5f1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -84,7 +84,7 @@ fn download_media(video_url: &str, download_path: &Path, settings: &Settings) -> } else if video_url.contains("soundcloud.com") { println!("[INFO] Soundcloud link detected. Using scdl..."); cmd = Command::new("scdl"); - cmd.args(["-l", video_url, "--no-mtime"]); + cmd.args(["-l", video_url]); } else { println!("[INFO] Non-Apple Music link. Using yt-dlp..."); cmd = Command::new("yt-dlp"); @@ -108,11 +108,18 @@ fn transfer_files(source_path: &Path, settings: &Settings) -> Result<()> { if !is_empty { if settings.nas_host == "localhost" { - println!("[INFO] NAS_HOST is localhost, copying files locally..."); - let mut options = fs_extra::dir::CopyOptions::new(); - options.content_only = true; - fs_extra::dir::copy(source_path, &settings.nas_path, &options) - .context("Failed to copy files locally")?; + println!("[INFO] NAS_HOST is localhost, copying files locally via rsync..."); + let mut rsync_cmd = Command::new("rsync"); + let source = format!( + "{}/", + source_path.to_str().context("Invalid source path")? + ); + rsync_cmd.args(["-r", &source, &settings.nas_path]); + + let status = rsync_cmd.status().context("Failed to execute rsync")?; + if !status.success() { + anyhow::bail!("rsync failed with status: {}", status); + } } else { println!("[INFO] Transferring files to NAS via scp..."); let mut scp_cmd = Command::new("scp");