From 087742430d541324ef3a5d272d2f5b4210b4d543 Mon Sep 17 00:00:00 2001 From: Chaos Rogers Date: Fri, 31 Oct 2025 23:17:32 +0000 Subject: [PATCH] feat: switch NAS transfer from scp to rsync over SSH and update README Co-authored-by: aider (openai/gpt-5) --- README.md | 3 ++- src/main.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 10dbd23..3021f6d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A command-line tool to download music from various sources like Apple Music, Sou ## Description -`jamdl` is a wrapper around popular downloaders (`gamdl`, `scdl`, `yt-dlp`) that automates the process of downloading media and transferring it to a specified location, such as a local directory or a remote NAS via SCP. +`jamdl` is a wrapper around popular downloaders (`gamdl`, `scdl`, `yt-dlp`) that automates the process of downloading media and transferring it to a specified location, such as a local directory or a remote NAS via rsync over SSH. ## Prerequisites @@ -12,6 +12,7 @@ You must have the following command-line tools installed and available in your s - `gamdl` (for Apple Music) - `scdl` (for SoundCloud) - `yt-dlp` (for other sources) +- `rsync` (for file transfers; remote copies use rsync over SSH) ## Installation diff --git a/src/main.rs b/src/main.rs index c870e69..b0c146f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -192,21 +192,21 @@ fn transfer_files(source_path: &Path, settings: &Settings) -> Result<()> { anyhow::bail!("rsync failed with status: {}", status); } } else { - println!("[INFO] Transferring files to NAS via scp..."); - let mut scp_cmd = Command::new("scp"); + println!("[INFO] Transferring files to NAS via rsync over SSH..."); + let mut rsync_cmd = Command::new("rsync"); let source = format!( - "{}/.", + "{}/", source_path.to_str().context("Invalid source path")? ); let destination = format!( "{}@{}:{}", settings.nas_user, settings.nas_host, settings.nas_path ); - scp_cmd.args(["-r", &source, &destination]); + rsync_cmd.args(["-r", "-e", "ssh", &source, &destination]); - let status = scp_cmd.status().context("Failed to execute scp")?; + let status = rsync_cmd.status().context("Failed to execute rsync")?; if !status.success() { - anyhow::bail!("scp failed with status: {}", status); + anyhow::bail!("rsync failed with status: {}", status); } } } else {