本文整理汇总了Python中mutagen.asf.ASF.tags[name]方法的典型用法代码示例。如果您正苦于以下问题:Python ASF.tags[name]方法的具体用法?Python ASF.tags[name]怎么用?Python ASF.tags[name]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mutagen.asf.ASF
的用法示例。
在下文中一共展示了ASF.tags[name]方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _save
# 需要导入模块: from mutagen.asf import ASF [as 别名]
# 或者: from mutagen.asf.ASF import tags[name] [as 别名]
def _save(self, filename, metadata):
log.debug("Saving file %r", filename)
file = ASF(encode_filename(filename))
if config.setting['clear_existing_tags']:
file.tags.clear()
if config.setting['save_images_to_tags']:
cover = []
for image in metadata.images:
if not save_this_image_to_tags(image):
continue
tag_data = pack_image(image.mimetype, image.data,
image_type_as_id3_num(image.maintype()),
image.description)
cover.append(ASFByteArrayAttribute(tag_data))
if cover:
file.tags['WM/Picture'] = cover
for name, values in metadata.rawitems():
if name.startswith('lyrics:'):
name = 'lyrics'
elif name == '~rating':
values[0] = int(values[0]) * 99 / (config.setting['rating_steps'] - 1)
if name not in self.__TRANS:
continue
name = self.__TRANS[name]
file.tags[name] = map(unicode, values)
file.save()
示例2: _save
# 需要导入模块: from mutagen.asf import ASF [as 别名]
# 或者: from mutagen.asf.ASF import tags[name] [as 别名]
def _save(self, filename, metadata):
log.debug("Saving file %r", filename)
file = ASF(encode_filename(filename))
if config.setting["clear_existing_tags"]:
file.tags.clear()
if config.setting["save_images_to_tags"]:
cover = []
for image in metadata.images:
if not save_this_image_to_tags(image):
continue
tag_data = pack_image(image["mime"], image["data"], image_type_as_id3_num(image["type"]), image["desc"])
cover.append(ASFByteArrayAttribute(tag_data))
if cover:
file.tags["WM/Picture"] = cover
for name, values in metadata.rawitems():
if name.startswith("lyrics:"):
name = "lyrics"
elif name == "~rating":
values[0] = int(values[0]) * 99 / (config.setting["rating_steps"] - 1)
if name not in self.__TRANS:
continue
name = self.__TRANS[name]
file.tags[name] = map(unicode, values)
file.save()
示例3: _save
# 需要导入模块: from mutagen.asf import ASF [as 别名]
# 或者: from mutagen.asf.ASF import tags[name] [as 别名]
def _save(self, filename, metadata):
log.debug("Saving file %r", filename)
file = ASF(encode_filename(filename))
if config.setting['clear_existing_tags']:
file.tags.clear()
cover = []
for image in metadata.images_to_be_saved_to_tags:
tag_data = pack_image(image.mimetype, image.data,
image_type_as_id3_num(image.maintype),
image.comment)
cover.append(ASFByteArrayAttribute(tag_data))
if cover:
file.tags['WM/Picture'] = cover
for name, values in metadata.rawitems():
if name.startswith('lyrics:'):
name = 'lyrics'
elif name == '~rating':
values[0] = int(values[0]) * 99 / (config.setting['rating_steps'] - 1)
elif name == 'discnumber' and 'totaldiscs' in metadata:
values[0] = '%s/%s' % (metadata['discnumber'], metadata['totaldiscs'])
if name not in self.__TRANS:
continue
name = self.__TRANS[name]
file.tags[name] = map(unicode, values)
file.save()
示例4: _save
# 需要导入模块: from mutagen.asf import ASF [as 别名]
# 或者: from mutagen.asf.ASF import tags[name] [as 别名]
def _save(self, filename, metadata, settings):
self.log.debug("Saving file %r", filename)
file = ASF(encode_filename(filename))
if settings['clear_existing_tags']:
file.tags.clear()
if settings['save_images_to_tags']:
cover = []
for image in metadata.images:
if self.config.setting["save_only_front_images_to_tags"] and image["type"] != "front":
continue
imagetype = ID3_IMAGE_TYPE_MAP.get(image["type"], 0)
tag_data = pack_image(image["mime"], image["data"], imagetype,
image["description"])
cover.append(ASFByteArrayAttribute(tag_data))
if cover:
file.tags['WM/Picture'] = cover
for name, values in metadata.rawitems():
if name.startswith('lyrics:'):
name = 'lyrics'
elif name == '~rating':
values[0] = int(values[0]) * 99 / (settings['rating_steps'] - 1)
if name not in self.__TRANS:
continue
name = self.__TRANS[name]
file.tags[name] = map(unicode, values)
file.save()
示例5: _save
# 需要导入模块: from mutagen.asf import ASF [as 别名]
# 或者: from mutagen.asf.ASF import tags[name] [as 别名]
def _save(self, filename, metadata, settings):
self.log.debug("Saving file %r", filename)
file = ASF(encode_filename(filename))
if settings["clear_existing_tags"]:
file.tags.clear()
if settings["save_images_to_tags"]:
cover = []
for mime, data in metadata.images:
tag_data = pack_image(mime, data, 3)
cover.append(ASFByteArrayAttribute(tag_data))
if cover:
file.tags["WM/Picture"] = cover
for name, values in metadata.rawitems():
if name.startswith("lyrics:"):
name = "lyrics"
elif name == "~rating":
values[0] = int(values[0]) * 99 / (settings["rating_steps"] - 1)
if name not in self.__TRANS:
continue
name = self.__TRANS[name]
file.tags[name] = map(unicode, values)
file.save()