mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-07-18 11:18:30 +00:00
Inline value formatting
This commit is contained in:
parent
bac71d6a75
commit
2737255d94
@ -44,13 +44,6 @@ class XAttrMetadataPP(PostProcessor):
|
|||||||
</array>
|
</array>
|
||||||
</plist>'''
|
</plist>'''
|
||||||
|
|
||||||
def format_value(self, xattrname, infoname, value):
|
|
||||||
if infoname == 'upload_date':
|
|
||||||
return hyphenate_date(value)
|
|
||||||
if xattrname == 'com.apple.metadata:kMDItemWhereFroms':
|
|
||||||
return self.APPLE_PLIST_TEMPLATE % value
|
|
||||||
return value
|
|
||||||
|
|
||||||
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')
|
||||||
@ -58,7 +51,10 @@ def run(self, info):
|
|||||||
try:
|
try:
|
||||||
value = info.get(infoname)
|
value = info.get(infoname)
|
||||||
if value:
|
if value:
|
||||||
value = self.format_value(xattrname, infoname, value)
|
if infoname == 'upload_date':
|
||||||
|
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