0
0
Fork 0

[xattr] Coding style

main
Philipp Hagemeister 2014-01-07 05:45:15 +01:00
parent 5f263296ea
commit ad84831537
1 changed files with 8 additions and 7 deletions

View File

@ -523,6 +523,7 @@ class FFmpegMergerPP(FFmpegPostProcessor):
self.run_ffmpeg_multiple_files(info['__files_to_merge'], filename, args) self.run_ffmpeg_multiple_files(info['__files_to_merge'], filename, args)
return True, info return True, info
class XAttrMetadataPP(PostProcessor): class XAttrMetadataPP(PostProcessor):
# #
@ -602,9 +603,9 @@ class XAttrMetadataPP(PostProcessor):
assert(path.find(":") < 0) assert(path.find(":") < 0)
assert(os.path.exists(path)) assert(os.path.exists(path))
f = open(path+":"+key, "w") ads_fn = path + ":" + key
f.write(value) with open(ads_fn, "w") as f:
f.close() f.write(value)
# Write the metadata to the file's xattrs # Write the metadata to the file's xattrs
self._downloader.to_screen('[metadata] Writing metadata to file\'s xattrs...') self._downloader.to_screen('[metadata] Writing metadata to file\'s xattrs...')
@ -613,13 +614,13 @@ class XAttrMetadataPP(PostProcessor):
try: try:
xattr_mapping = { xattr_mapping = {
'user.xdg.referrer.url': 'webpage_url', 'user.xdg.referrer.url': 'webpage_url',
# 'user.xdg.comment': 'description', # 'user.xdg.comment': 'description',
'user.dublincore.title': 'title', 'user.dublincore.title': 'title',
'user.dublincore.date': 'upload_date', 'user.dublincore.date': 'upload_date',
'user.dublincore.description': 'description', 'user.dublincore.description': 'description',
'user.dublincore.contributor': 'uploader', 'user.dublincore.contributor': 'uploader',
'user.dublincore.format': 'format', 'user.dublincore.format': 'format',
} }
for xattrname, infoname in xattr_mapping.items(): for xattrname, infoname in xattr_mapping.items():