[__init__] Fix lost xattr if --embed-thumbnail used

Reported at
https://github.com/rg3/youtube-dl/issues/9054#issuecomment-250451823
This commit is contained in:
Yen Chi Hsuan 2016-10-02 02:12:14 +08:00
parent f6ba581f89
commit b19e275d99
No known key found for this signature in database
GPG Key ID: 3FDDD575826C5C30
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,7 @@
version <unreleased> version <unreleased>
Core Core
* Fix possibly lost extended attributes
+ Support pyxattr as well as python-xattr for --xattrs and + Support pyxattr as well as python-xattr for --xattrs and
--xattr-set-filesize (#9054) --xattr-set-filesize (#9054)

View File

@ -266,8 +266,6 @@ def _real_main(argv=None):
postprocessors.append({ postprocessors.append({
'key': 'FFmpegEmbedSubtitle', 'key': 'FFmpegEmbedSubtitle',
}) })
if opts.xattrs:
postprocessors.append({'key': 'XAttrMetadata'})
if opts.embedthumbnail: if opts.embedthumbnail:
already_have_thumbnail = opts.writethumbnail or opts.write_all_thumbnails already_have_thumbnail = opts.writethumbnail or opts.write_all_thumbnails
postprocessors.append({ postprocessors.append({
@ -276,6 +274,10 @@ def _real_main(argv=None):
}) })
if not already_have_thumbnail: if not already_have_thumbnail:
opts.writethumbnail = True 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. # 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. # So if the user is able to remove the file before your postprocessor runs it might cause a few problems.
if opts.exec_cmd: if opts.exec_cmd: