]> jfr.im git - yt-dlp.git/commitdiff
[embedthumbnail] Set mtime correctly
authorpukkandan <redacted>
Sun, 14 Mar 2021 16:23:54 +0000 (21:53 +0530)
committerpukkandan <redacted>
Sun, 14 Mar 2021 16:26:04 +0000 (21:56 +0530)
Related: https://github.com/yt-dlp/yt-dlp/issues/67

yt_dlp/postprocessor/embedthumbnail.py

index 3c68e0298478c60f83e738d5a0c24e45611f430c..82e7e200414e665f23fdf0f7b3cbe502eaa3f3b1 100644 (file)
@@ -85,6 +85,8 @@ def is_webp(path):
             thumbnail_filename = thumbnail_jpg_filename
             thumbnail_ext = 'jpg'
 
+        mtime = os.stat(encodeFilename(filename)).st_mtime
+
         success = True
         if info['ext'] == 'mp3':
             options = [
@@ -187,6 +189,8 @@ def is_webp(path):
             os.remove(encodeFilename(filename))
             os.rename(encodeFilename(temp_filename), encodeFilename(filename))
 
+        self.try_utime(filename, mtime, mtime)
+
         files_to_delete = [thumbnail_filename]
         if self._already_have_thumbnail:
             info['__files_to_move'][original_thumbnail] = replace_extension(