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:
parent
d9f63a5fc1
commit
087742430d
2 changed files with 8 additions and 7 deletions
|
|
@ -4,7 +4,7 @@ A command-line tool to download music from various sources like Apple Music, Sou
|
||||||
|
|
||||||
## Description
|
## 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
|
## Prerequisites
|
||||||
|
|
||||||
|
|
@ -12,6 +12,7 @@ You must have the following command-line tools installed and available in your s
|
||||||
- `gamdl` (for Apple Music)
|
- `gamdl` (for Apple Music)
|
||||||
- `scdl` (for SoundCloud)
|
- `scdl` (for SoundCloud)
|
||||||
- `yt-dlp` (for other sources)
|
- `yt-dlp` (for other sources)
|
||||||
|
- `rsync` (for file transfers; remote copies use rsync over SSH)
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|
|
||||||
12
src/main.rs
12
src/main.rs
|
|
@ -192,21 +192,21 @@ fn transfer_files(source_path: &Path, settings: &Settings) -> Result<()> {
|
||||||
anyhow::bail!("rsync failed with status: {}", status);
|
anyhow::bail!("rsync failed with status: {}", status);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
println!("[INFO] Transferring files to NAS via scp...");
|
println!("[INFO] Transferring files to NAS via rsync over SSH...");
|
||||||
let mut scp_cmd = Command::new("scp");
|
let mut rsync_cmd = Command::new("rsync");
|
||||||
let source = format!(
|
let source = format!(
|
||||||
"{}/.",
|
"{}/",
|
||||||
source_path.to_str().context("Invalid source path")?
|
source_path.to_str().context("Invalid source path")?
|
||||||
);
|
);
|
||||||
let destination = format!(
|
let destination = format!(
|
||||||
"{}@{}:{}",
|
"{}@{}:{}",
|
||||||
settings.nas_user, settings.nas_host, settings.nas_path
|
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() {
|
if !status.success() {
|
||||||
anyhow::bail!("scp failed with status: {}", status);
|
anyhow::bail!("rsync failed with status: {}", status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue