diff options
author | Tom-Oliver Heidel <github@tom-oliver.eu> | 2020-11-30 02:51:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-30 02:51:41 +0100 |
commit | b662fc8d2033c615ffbdd3b51123b446c03255e8 (patch) | |
tree | 3d32dc25a663f4e61fc28860acda67c7a425cb7a /youtube_dlc/postprocessor/embedthumbnail.py | |
parent | 8924ddc3eec4c03c6776673d0d5e823dc5445549 (diff) | |
parent | 929576bb9e4aa31f0516f1437d2ae762afdd9f2c (diff) | |
download | hypervideo-pre-b662fc8d2033c615ffbdd3b51123b446c03255e8.tar.lz hypervideo-pre-b662fc8d2033c615ffbdd3b51123b446c03255e8.tar.xz hypervideo-pre-b662fc8d2033c615ffbdd3b51123b446c03255e8.zip |
Merge branch 'master' into gedi
Diffstat (limited to 'youtube_dlc/postprocessor/embedthumbnail.py')
-rw-r--r-- | youtube_dlc/postprocessor/embedthumbnail.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/youtube_dlc/postprocessor/embedthumbnail.py b/youtube_dlc/postprocessor/embedthumbnail.py index 4a0d02fc4..e9f2161a0 100644 --- a/youtube_dlc/postprocessor/embedthumbnail.py +++ b/youtube_dlc/postprocessor/embedthumbnail.py @@ -89,12 +89,15 @@ class EmbedThumbnailPP(FFmpegPostProcessor): os.rename(encodeFilename(temp_filename), encodeFilename(filename)) elif info['ext'] == 'mkv': - os.rename(encodeFilename(thumbnail_filename), encodeFilename('cover.jpg')) old_thumbnail_filename = thumbnail_filename - thumbnail_filename = 'cover.jpg' + thumbnail_filename = os.path.join(os.path.dirname(old_thumbnail_filename), 'cover.jpg') + if os.path.exists(thumbnail_filename): + os.remove(encodeFilename(thumbnail_filename)) + os.rename(encodeFilename(old_thumbnail_filename), encodeFilename(thumbnail_filename)) options = [ - '-c', 'copy', '-attach', thumbnail_filename, '-metadata:s:t', 'mimetype=image/jpeg'] + '-c', 'copy', '-map', '0', + '-attach', thumbnail_filename, '-metadata:s:t', 'mimetype=image/jpeg'] self._downloader.to_screen('[ffmpeg] Adding thumbnail to "%s"' % filename) @@ -140,6 +143,6 @@ class EmbedThumbnailPP(FFmpegPostProcessor): os.remove(encodeFilename(filename)) os.rename(encodeFilename(temp_filename), encodeFilename(filename)) else: - raise EmbedThumbnailPPError('Only mp3 and m4a/mp4 are supported for thumbnail embedding for now.') + raise EmbedThumbnailPPError('Only mp3, mkv, m4a and mp4 are supported for thumbnail embedding for now.') return [], info |