1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-27 19:04:32 +01:00

set timestamp after embedthumbnail (closes #9355)

modified:   youtube_dl/postprocessor/embedthumbnail.py
This commit is contained in:
J. Randall Owens 2017-11-13 16:57:43 +00:00
parent 27adc9ec65
commit 0d89117382

View File

@ -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.')