fix: Remove unsupported scdl flag and use rsync for local copy
Co-authored-by: aider (gemini/gemini-2.5-pro-preview-05-06) <aider@aider.chat>
This commit is contained in:
parent
cd3748d33f
commit
469472d289
1 changed files with 13 additions and 6 deletions
19
src/main.rs
19
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") {
|
} else if video_url.contains("soundcloud.com") {
|
||||||
println!("[INFO] Soundcloud link detected. Using scdl...");
|
println!("[INFO] Soundcloud link detected. Using scdl...");
|
||||||
cmd = Command::new("scdl");
|
cmd = Command::new("scdl");
|
||||||
cmd.args(["-l", video_url, "--no-mtime"]);
|
cmd.args(["-l", video_url]);
|
||||||
} else {
|
} else {
|
||||||
println!("[INFO] Non-Apple Music link. Using yt-dlp...");
|
println!("[INFO] Non-Apple Music link. Using yt-dlp...");
|
||||||
cmd = Command::new("yt-dlp");
|
cmd = Command::new("yt-dlp");
|
||||||
|
|
@ -108,11 +108,18 @@ fn transfer_files(source_path: &Path, settings: &Settings) -> Result<()> {
|
||||||
|
|
||||||
if !is_empty {
|
if !is_empty {
|
||||||
if settings.nas_host == "localhost" {
|
if settings.nas_host == "localhost" {
|
||||||
println!("[INFO] NAS_HOST is localhost, copying files locally...");
|
println!("[INFO] NAS_HOST is localhost, copying files locally via rsync...");
|
||||||
let mut options = fs_extra::dir::CopyOptions::new();
|
let mut rsync_cmd = Command::new("rsync");
|
||||||
options.content_only = true;
|
let source = format!(
|
||||||
fs_extra::dir::copy(source_path, &settings.nas_path, &options)
|
"{}/",
|
||||||
.context("Failed to copy files locally")?;
|
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 {
|
} else {
|
||||||
println!("[INFO] Transferring files to NAS via scp...");
|
println!("[INFO] Transferring files to NAS via scp...");
|
||||||
let mut scp_cmd = Command::new("scp");
|
let mut scp_cmd = Command::new("scp");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue