[__init__] Fix lost xattr if --embed-thumbnail used
authorYen Chi Hsuan <yan12125@gmail.com>
Sat, 1 Oct 2016 18:12:14 +0000 (02:12 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Sat, 1 Oct 2016 18:12:14 +0000 (02:12 +0800)
Reported at
https://github.com/rg3/youtube-dl/issues/9054#issuecomment-250451823

ChangeLog
youtube_dl/__init__.py

index 8ef39cd63ce1aa3f3c14c25bb117a6ca1b0f65b1..acceb9d0266dc936e872f113cd453674ef6fad81 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 version <unreleased>
 
 Core
+* Fix possibly lost extended attributes
 + Support pyxattr as well as python-xattr for --xattrs and
   --xattr-set-filesize (#9054)
 
index 72141b983d6ec1c62f58eff3920d80e77a9eee39..f84b866df8695739731e3179f67152cf0eacf475 100644 (file)
@@ -266,8 +266,6 @@ def _real_main(argv=None):
         postprocessors.append({
             'key': 'FFmpegEmbedSubtitle',
         })
-    if opts.xattrs:
-        postprocessors.append({'key': 'XAttrMetadata'})
     if opts.embedthumbnail:
         already_have_thumbnail = opts.writethumbnail or opts.write_all_thumbnails
         postprocessors.append({
@@ -276,6 +274,10 @@ def _real_main(argv=None):
         })
         if not already_have_thumbnail:
             opts.writethumbnail = True
+    # XAttrMetadataPP should be run after post-processors that may change file
+    # contents
+    if opts.xattrs:
+        postprocessors.append({'key': 'XAttrMetadata'})
     # Please keep ExecAfterDownload towards the bottom as it allows the user to modify the final file in any way.
     # So if the user is able to remove the file before your postprocessor runs it might cause a few problems.
     if opts.exec_cmd: