当前位置: 首页>>代码示例>>Python>>正文


Python ASF.tags[name]方法代码示例

本文整理汇总了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()
开发者ID:m42i,项目名称:picard,代码行数:30,代码来源:asf.py

示例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()
开发者ID:TushRaj,项目名称:picard,代码行数:28,代码来源:asf.py

示例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()
开发者ID:LordSputnik,项目名称:picard,代码行数:29,代码来源:asf.py

示例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()
开发者ID:Rawrpwnzl,项目名称:picard,代码行数:30,代码来源:asf.py

示例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()
开发者ID:lalinsky,项目名称:picard-debian,代码行数:26,代码来源:asf.py


注:本文中的mutagen.asf.ASF.tags[name]方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。