aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dlc/postprocessor/embedthumbnail.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan@gmail.com>2020-11-15 01:42:07 +0530
committerpukkandan <pukkandan@gmail.com>2020-11-15 01:46:52 +0530
commit55faba7ed77abad9dfe00bf850b9f8c4b04b036d (patch)
tree979d67fa66fb13de0e2c33a5eb55a6703433826a /youtube_dlc/postprocessor/embedthumbnail.py
parentd052b9a112fb7ae749a829dceba6e3289663a303 (diff)
downloadhypervideo-pre-55faba7ed77abad9dfe00bf850b9f8c4b04b036d.tar.lz
hypervideo-pre-55faba7ed77abad9dfe00bf850b9f8c4b04b036d.tar.xz
hypervideo-pre-55faba7ed77abad9dfe00bf850b9f8c4b04b036d.zip
Fix for os.rename error when embedding thumbnail to video in a different drive
Diffstat (limited to 'youtube_dlc/postprocessor/embedthumbnail.py')
-rw-r--r--youtube_dlc/postprocessor/embedthumbnail.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/youtube_dlc/postprocessor/embedthumbnail.py b/youtube_dlc/postprocessor/embedthumbnail.py
index 4a0d02fc4..a7d53d7f5 100644
--- a/youtube_dlc/postprocessor/embedthumbnail.py
+++ b/youtube_dlc/postprocessor/embedthumbnail.py
@@ -89,9 +89,10 @@ 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')
+ 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']