Skip to content

Commit

Permalink
Remove the broken mkv file when ffmpeg fails.
Browse files Browse the repository at this point in the history
This happens, for example, when there is not enough free space available to create the `mkv` file.
  • Loading branch information
trizen committed Oct 14, 2022
1 parent e61d210 commit 92c92d0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bin/youtube-viewer
Original file line number Diff line number Diff line change
Expand Up @@ -4158,6 +4158,12 @@ sub download_video {
unlink @merge_files;
$video_filename = $mkv_filename;
}
elsif ($? != 0) { # ffmpeg failed
if (-e $mkv_filename) { # probably due to not enough space
unlink $mkv_filename; # remove the mkv file
}
return;
}
}

# Convert the downloaded video
Expand Down

0 comments on commit 92c92d0

Please sign in to comment.