mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-07-18 03:08:31 +00:00
Merge a6bede39b8
into 3a84be9d16
This commit is contained in:
commit
bcb8184dfb
@ -33,8 +33,17 @@ class XAttrMetadataPP(PostProcessor):
|
|||||||
# (e.g., 4kB on ext4), and we don't want to have the other ones fail
|
# (e.g., 4kB on ext4), and we don't want to have the other ones fail
|
||||||
'user.dublincore.description': 'description',
|
'user.dublincore.description': 'description',
|
||||||
# 'user.xdg.comment': 'description',
|
# 'user.xdg.comment': 'description',
|
||||||
|
'com.apple.metadata:kMDItemWhereFroms': 'webpage_url',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
APPLE_PLIST_TEMPLATE = '''<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<array>
|
||||||
|
\t<string>%s</string>
|
||||||
|
</array>
|
||||||
|
</plist>'''
|
||||||
|
|
||||||
def run(self, info):
|
def run(self, info):
|
||||||
mtime = os.stat(info['filepath']).st_mtime
|
mtime = os.stat(info['filepath']).st_mtime
|
||||||
self.to_screen('Writing metadata to file\'s xattrs')
|
self.to_screen('Writing metadata to file\'s xattrs')
|
||||||
@ -44,6 +53,8 @@ def run(self, info):
|
|||||||
if value:
|
if value:
|
||||||
if infoname == 'upload_date':
|
if infoname == 'upload_date':
|
||||||
value = hyphenate_date(value)
|
value = hyphenate_date(value)
|
||||||
|
elif xattrname == 'com.apple.metadata:kMDItemWhereFroms':
|
||||||
|
value = self.APPLE_PLIST_TEMPLATE % value
|
||||||
write_xattr(info['filepath'], xattrname, value.encode())
|
write_xattr(info['filepath'], xattrname, value.encode())
|
||||||
|
|
||||||
except XAttrUnavailableError as e:
|
except XAttrUnavailableError as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user