always delete intermediate files
This commit is contained in:
parent
5674105c12
commit
ea0d75b7eb
1 changed files with 8 additions and 8 deletions
16
src/dl.rs
16
src/dl.rs
|
|
@ -152,19 +152,19 @@ pub async fn download(url: &str) -> Result<String, DownloadError> {
|
||||||
vf.format_id,
|
vf.format_id,
|
||||||
af.format_id
|
af.format_id
|
||||||
);
|
);
|
||||||
match FFMpeg::join_audio_video(
|
|
||||||
|
let res = FFMpeg::join_audio_video(
|
||||||
video_path.as_str(),
|
video_path.as_str(),
|
||||||
audio_path.as_str(),
|
audio_path.as_str(),
|
||||||
abr,
|
abr,
|
||||||
output_path.as_str(),
|
output_path.as_str(),
|
||||||
)
|
)
|
||||||
.await
|
.await;
|
||||||
{
|
delete_if_exists(&video_path);
|
||||||
|
delete_if_exists(&audio_path);
|
||||||
|
|
||||||
|
match res {
|
||||||
Ok(()) => Ok(output_path),
|
Ok(()) => Ok(output_path),
|
||||||
Err(e) => {
|
Err(e) => Err(DownloadError::Message(e.to_string())),
|
||||||
delete_if_exists(&video_path);
|
|
||||||
delete_if_exists(&audio_path);
|
|
||||||
return Err(DownloadError::Message(e.to_string()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue