aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNil Admirari <50202386+nihil-admirari@users.noreply.github.com>2022-02-17 17:10:34 +0000
committerGitHub <noreply@github.com>2022-02-17 09:10:34 -0800
commitae419aa94fc16f4b55fe8b61159f66e085ae5b8b (patch)
treec4c5d072a50c1cd2bafd677881f1a4fe92199415
parentac184ab742115ba9f8d3365c0f630db53567fc01 (diff)
downloadhypervideo-pre-ae419aa94fc16f4b55fe8b61159f66e085ae5b8b.tar.lz
hypervideo-pre-ae419aa94fc16f4b55fe8b61159f66e085ae5b8b.tar.xz
hypervideo-pre-ae419aa94fc16f4b55fe8b61159f66e085ae5b8b.zip
[Sponsorblock] minor fixes (#2793)
* preserve mtime - Closes #2769 * keep concat spec on failure Authored by: nihil-admirari
-rw-r--r--yt_dlp/postprocessor/ffmpeg.py10
-rw-r--r--yt_dlp/postprocessor/modify_chapters.py2
2 files changed, 6 insertions, 6 deletions
diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py
index 42e9d12a7..05eeee2d7 100644
--- a/yt_dlp/postprocessor/ffmpeg.py
+++ b/yt_dlp/postprocessor/ffmpeg.py
@@ -384,12 +384,10 @@ class FFmpegPostProcessor(PostProcessor):
out_flags = list(self.stream_copy_opts(ext=determine_ext(out_file)))
- try:
- self.real_run_ffmpeg(
- [(concat_file, ['-hide_banner', '-nostdin', '-f', 'concat', '-safe', '0'])],
- [(out_file, out_flags)])
- finally:
- os.remove(concat_file)
+ self.real_run_ffmpeg(
+ [(concat_file, ['-hide_banner', '-nostdin', '-f', 'concat', '-safe', '0'])],
+ [(out_file, out_flags)])
+ os.remove(concat_file)
@classmethod
def _concat_spec(cls, in_files, concat_opts=None):
diff --git a/yt_dlp/postprocessor/modify_chapters.py b/yt_dlp/postprocessor/modify_chapters.py
index 435a144e2..22506bc21 100644
--- a/yt_dlp/postprocessor/modify_chapters.py
+++ b/yt_dlp/postprocessor/modify_chapters.py
@@ -68,9 +68,11 @@ class ModifyChaptersPP(FFmpegPostProcessor):
# Renaming should only happen after all files are processed
files_to_remove = []
for in_file, out_file in in_out_files:
+ mtime = os.stat(in_file).st_mtime
uncut_file = prepend_extension(in_file, 'uncut')
os.replace(in_file, uncut_file)
os.replace(out_file, in_file)
+ self.try_utime(in_file, mtime, mtime)
files_to_remove.append(uncut_file)
return files_to_remove, info