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