From 76adb9074ab129fab29485f1dc97dc7276ef4849 Mon Sep 17 00:00:00 2001 From: Anthony Weems Date: Fri, 2 May 2014 03:32:44 -0500 Subject: [PATCH] take --keep-video option into account Unfortunately, we cannot simply return False from FFmpegConcatPP.run() because the current post_process() function merely deletes the specified filename. For this to work properly, the postprocessor should be able to specify the files it wants to delete alongside the flag to delete them. --- youtube_dl/postprocessor/ffmpeg.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py index 5a6033e28..9d8c055d7 100644 --- a/youtube_dl/postprocessor/ffmpeg.py +++ b/youtube_dl/postprocessor/ffmpeg.py @@ -501,8 +501,10 @@ class FFmpegConcatPP(FFmpegPostProcessor): args = ['-f', 'concat', '-i', '-', '-c', 'copy'] self._downloader.to_screen(u'[ffmpeg] Concatenating files into "%s"' % filename) self.run_ffmpeg_multiple_files(info['__files_to_merge'], filename, args, via_stdin=True) - for path in info['__files_to_merge']: - os.remove(encodeFilename(path)) + if self._downloader.params.get('keepvideo', False) is False: + for path in info['__files_to_merge']: + self._downloader.to_screen('Deleting original file %s (pass -k to keep)' % filename) + os.remove(encodeFilename(path)) return True, info class FFmpegAudioFixPP(FFmpegPostProcessor):