1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-30 20:27:54 +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', '-c', 'copy', '-map', '0', '-map', '1',
'-metadata:s:v', 'title="Album cover"', '-metadata:s:v', 'comment="Cover (Front)"'] '-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._downloader.to_screen('[ffmpeg] Adding thumbnail to "%s"' % filename)
self.run_ffmpeg_multiple_files([filename, thumbnail_filename], temp_filename, options) 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(thumbnail_filename))
os.remove(encodeFilename(filename)) os.remove(encodeFilename(filename))
os.rename(encodeFilename(temp_filename), encodeFilename(filename)) os.rename(encodeFilename(temp_filename), encodeFilename(filename))
os.utime(encodeFilename(filename, timestamp))
elif info['ext'] in ['m4a', 'mp4']: elif info['ext'] in ['m4a', 'mp4']:
if not check_executable('AtomicParsley', ['-v']): if not check_executable('AtomicParsley', ['-v']):
raise EmbedThumbnailPPError('AtomicParsley was not found. Please install.') raise EmbedThumbnailPPError('AtomicParsley was not found. Please install.')
timestamp = os.getmtime(encodeFilename(filename))
cmd = [encodeFilename('AtomicParsley', True), cmd = [encodeFilename('AtomicParsley', True),
encodeFilename(filename, True), encodeFilename(filename, True),
encodeArgument('--artwork'), encodeArgument('--artwork'),
@ -86,6 +91,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor):
else: else:
os.remove(encodeFilename(filename)) os.remove(encodeFilename(filename))
os.rename(encodeFilename(temp_filename), encodeFilename(filename)) os.rename(encodeFilename(temp_filename), encodeFilename(filename))
os.utime(encodeFilename(filename, timestamp))
else: else:
raise EmbedThumbnailPPError('Only mp3 and m4a/mp4 are supported for thumbnail embedding for now.') raise EmbedThumbnailPPError('Only mp3 and m4a/mp4 are supported for thumbnail embedding for now.')