Subject: | Don't leave failed empty files |
--- youtube-download.org 2012-09-30 11:25:14.928707309 +0200
+++ youtube-download 2012-09-30 11:26:16.858703905 +0200
@@ -63,7 +63,10 @@ main: {
overwrite => $overwrite,
});
};
- throw("[$meta_data->{video_id}] $@") if $@;
+ if ($@) {
+ -e $filename && !-s $filename and unlink $filename;
+ throw("[$meta_data->{video_id}] $@");
+ }
chatty(colored ['green'], 'Download successfully!');
Time::HiRes::sleep($interval) if @ARGV;