feat: switch NAS transfer from scp to rsync over SSH and update README

Co-authored-by: aider (openai/gpt-5) <aider@aider.chat>
This commit is contained in:
Chaos Rogers 2025-10-31 23:17:32 +00:00
parent d9f63a5fc1
commit 087742430d
2 changed files with 8 additions and 7 deletions

View file

@ -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

View file

@ -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 {