From 0d89117382c6b92eb02207c2a42c9569766ac51f Mon Sep 17 00:00:00 2001 From: "J. Randall Owens" Date: Mon, 13 Nov 2017 16:57:43 +0000 Subject: [PATCH 1/3] set timestamp after embedthumbnail (closes #9355) modified: youtube_dl/postprocessor/embedthumbnail.py --- youtube_dl/postprocessor/embedthumbnail.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/youtube_dl/postprocessor/embedthumbnail.py b/youtube_dl/postprocessor/embedthumbnail.py index e606a58de..90d8f71b0 100644 --- a/youtube_dl/postprocessor/embedthumbnail.py +++ b/youtube_dl/postprocessor/embedthumbnail.py @@ -45,6 +45,8 @@ class EmbedThumbnailPP(FFmpegPostProcessor): '-c', 'copy', '-map', '0', '-map', '1', '-metadata:s:v', 'title="Album cover"', '-metadata:s:v', 'comment="Cover (Front)"'] + timestamp = os.getmtime(encodeFilename(filename)) + self._downloader.to_screen('[ffmpeg] Adding thumbnail to "%s"' % filename) self.run_ffmpeg_multiple_files([filename, thumbnail_filename], temp_filename, options) @@ -53,11 +55,14 @@ class EmbedThumbnailPP(FFmpegPostProcessor): os.remove(encodeFilename(thumbnail_filename)) os.remove(encodeFilename(filename)) os.rename(encodeFilename(temp_filename), encodeFilename(filename)) + os.utime(encodeFilename(filename, timestamp)) elif info['ext'] in ['m4a', 'mp4']: if not check_executable('AtomicParsley', ['-v']): raise EmbedThumbnailPPError('AtomicParsley was not found. Please install.') + timestamp = os.getmtime(encodeFilename(filename)) + cmd = [encodeFilename('AtomicParsley', True), encodeFilename(filename, True), encodeArgument('--artwork'), @@ -86,6 +91,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor): else: os.remove(encodeFilename(filename)) os.rename(encodeFilename(temp_filename), encodeFilename(filename)) + os.utime(encodeFilename(filename, timestamp)) else: raise EmbedThumbnailPPError('Only mp3 and m4a/mp4 are supported for thumbnail embedding for now.') From 4b3dbbae52931cf38bf3f7c88f8660e1885290c7 Mon Sep 17 00:00:00 2001 From: "J. Randall Owens" Date: Mon, 13 Nov 2017 17:22:01 +0000 Subject: [PATCH 2/3] fix full function name of os.path.getmtime() modified: youtube_dl/postprocessor/embedthumbnail.py --- youtube_dl/postprocessor/embedthumbnail.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/youtube_dl/postprocessor/embedthumbnail.py b/youtube_dl/postprocessor/embedthumbnail.py index 90d8f71b0..a6165cf0c 100644 --- a/youtube_dl/postprocessor/embedthumbnail.py +++ b/youtube_dl/postprocessor/embedthumbnail.py @@ -45,7 +45,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor): '-c', 'copy', '-map', '0', '-map', '1', '-metadata:s:v', 'title="Album cover"', '-metadata:s:v', 'comment="Cover (Front)"'] - timestamp = os.getmtime(encodeFilename(filename)) + timestamp = os.path.getmtime(encodeFilename(filename)) self._downloader.to_screen('[ffmpeg] Adding thumbnail to "%s"' % filename) @@ -61,7 +61,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor): if not check_executable('AtomicParsley', ['-v']): raise EmbedThumbnailPPError('AtomicParsley was not found. Please install.') - timestamp = os.getmtime(encodeFilename(filename)) + timestamp = os.path.getmtime(encodeFilename(filename)) cmd = [encodeFilename('AtomicParsley', True), encodeFilename(filename, True), From 6f45cf5f7bceeb2c4b51017d7aa6e9a8a559c59c Mon Sep 17 00:00:00 2001 From: "J. Randall Owens" Date: Mon, 13 Nov 2017 17:37:19 +0000 Subject: [PATCH 3/3] fix os.utime() syntax modified: youtube_dl/postprocessor/embedthumbnail.py --- youtube_dl/postprocessor/embedthumbnail.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/youtube_dl/postprocessor/embedthumbnail.py b/youtube_dl/postprocessor/embedthumbnail.py index a6165cf0c..037a22e94 100644 --- a/youtube_dl/postprocessor/embedthumbnail.py +++ b/youtube_dl/postprocessor/embedthumbnail.py @@ -55,7 +55,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor): os.remove(encodeFilename(thumbnail_filename)) os.remove(encodeFilename(filename)) os.rename(encodeFilename(temp_filename), encodeFilename(filename)) - os.utime(encodeFilename(filename, timestamp)) + os.utime(encodeFilename(filename), (timestamp, timestamp)) elif info['ext'] in ['m4a', 'mp4']: if not check_executable('AtomicParsley', ['-v']): @@ -91,7 +91,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor): else: os.remove(encodeFilename(filename)) os.rename(encodeFilename(temp_filename), encodeFilename(filename)) - os.utime(encodeFilename(filename, timestamp)) + os.utime(encodeFilename(filename), (timestamp, timestamp)) else: raise EmbedThumbnailPPError('Only mp3 and m4a/mp4 are supported for thumbnail embedding for now.')