aboutsummaryrefslogtreecommitdiff
path: root/yt_dlp/postprocessor
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp/postprocessor')
-rw-r--r--yt_dlp/postprocessor/embedthumbnail.py4
-rw-r--r--yt_dlp/postprocessor/xattrpp.py9
2 files changed, 8 insertions, 5 deletions
diff --git a/yt_dlp/postprocessor/embedthumbnail.py b/yt_dlp/postprocessor/embedthumbnail.py
index caa841b2e..207be776e 100644
--- a/yt_dlp/postprocessor/embedthumbnail.py
+++ b/yt_dlp/postprocessor/embedthumbnail.py
@@ -79,9 +79,9 @@ class EmbedThumbnailPP(FFmpegPostProcessor):
original_thumbnail = thumbnail_filename = info['thumbnails'][idx]['filepath']
- thumbnail_ext = os.path.splitext(thumbnail_filename)[1][1:]
# Convert unsupported thumbnail formats (see #25687, #25717)
# PNG is preferred since JPEG is lossy
+ thumbnail_ext = os.path.splitext(thumbnail_filename)[1][1:]
if info['ext'] not in ('mkv', 'mka') and thumbnail_ext not in ('jpg', 'jpeg', 'png'):
thumbnail_filename = convertor.convert_thumbnail(thumbnail_filename, 'png')
thumbnail_ext = 'png'
@@ -100,7 +100,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor):
elif info['ext'] in ['mkv', 'mka']:
options = list(self.stream_copy_opts())
- mimetype = 'image/%s' % ('jpeg' if thumbnail_ext in ('jpg', 'jpeg') else thumbnail_ext)
+ mimetype = f'image/{thumbnail_ext.replace("jpg", "jpeg")}'
old_stream, new_stream = self.get_stream_number(
filename, ('tags', 'mimetype'), mimetype)
if old_stream is not None:
diff --git a/yt_dlp/postprocessor/xattrpp.py b/yt_dlp/postprocessor/xattrpp.py
index 3c431941b..d6ac9b876 100644
--- a/yt_dlp/postprocessor/xattrpp.py
+++ b/yt_dlp/postprocessor/xattrpp.py
@@ -1,3 +1,5 @@
+import os
+
from .common import PostProcessor
from ..compat import compat_os_name
from ..utils import (
@@ -28,6 +30,7 @@ class XAttrMetadataPP(PostProcessor):
self.to_screen('Writing metadata to file\'s xattrs')
filename = info['filepath']
+ mtime = os.stat(filename).st_mtime
try:
xattr_mapping = {
@@ -53,8 +56,6 @@ class XAttrMetadataPP(PostProcessor):
write_xattr(filename, xattrname, byte_value)
num_written += 1
- return [], info
-
except XAttrUnavailableError as e:
raise PostProcessingError(str(e))
@@ -73,4 +74,6 @@ class XAttrMetadataPP(PostProcessor):
else:
msg += '(You may have to enable them in your /etc/fstab)'
raise PostProcessingError(str(e))
- return [], info
+
+ self.try_utime(filename, mtime, mtime)
+ return [], info