本文整理汇总了Python中beets.plugins.BeetsPlugin.add_media_field方法的典型用法代码示例。如果您正苦于以下问题:Python BeetsPlugin.add_media_field方法的具体用法?Python BeetsPlugin.add_media_field怎么用?Python BeetsPlugin.add_media_field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类beets.plugins.BeetsPlugin
的用法示例。
在下文中一共展示了BeetsPlugin.add_media_field方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_extended_field_write
# 需要导入模块: from beets.plugins import BeetsPlugin [as 别名]
# 或者: from beets.plugins.BeetsPlugin import add_media_field [as 别名]
def test_extended_field_write(self):
plugin = BeetsPlugin()
plugin.add_media_field('customtag', field_extension)
mediafile = self._mediafile_fixture('empty')
mediafile.customtag = u'F#'
mediafile.save()
mediafile = MediaFile(mediafile.path)
self.assertEqual(mediafile.customtag, u'F#')
delattr(MediaFile, 'customtag')
Item._media_fields.remove('customtag')
示例2: test_read_flexible_attribute_from_file
# 需要导入模块: from beets.plugins import BeetsPlugin [as 别名]
# 或者: from beets.plugins.BeetsPlugin import add_media_field [as 别名]
def test_read_flexible_attribute_from_file(self):
plugin = BeetsPlugin()
plugin.add_media_field('initialkey', field_extension)
mediafile = self._mediafile_fixture('empty')
mediafile.update({'initialkey': 'F#'})
item = Item.from_path(mediafile.path)
self.assertEqual(item['initialkey'], 'F#')
delattr(MediaFile, 'initialkey')
Item.media_fields.remove('initialkey')
示例3: test_extended_field_write
# 需要导入模块: from beets.plugins import BeetsPlugin [as 别名]
# 或者: from beets.plugins.BeetsPlugin import add_media_field [as 别名]
def test_extended_field_write(self):
plugin = BeetsPlugin()
plugin.add_media_field('initialkey', field_extension)
mediafile = self._mediafile_fixture('empty')
mediafile.initialkey = 'F#'
mediafile.save()
mediafile = MediaFile(mediafile.path)
self.assertEqual(mediafile.initialkey, 'F#')
delattr(MediaFile, 'initialkey')
Item.media_fields.remove('initialkey')
示例4: test_read_flexible_attribute_from_file
# 需要导入模块: from beets.plugins import BeetsPlugin [as 别名]
# 或者: from beets.plugins.BeetsPlugin import add_media_field [as 别名]
def test_read_flexible_attribute_from_file(self):
plugin = BeetsPlugin()
plugin.add_media_field('customtag', field_extension)
mediafile = self._mediafile_fixture('empty')
mediafile.update({'customtag': u'F#'})
mediafile.save()
item = Item.from_path(mediafile.path)
self.assertEqual(item['customtag'], u'F#')
delattr(MediaFile, 'customtag')
Item._media_fields.remove('customtag')
示例5: test_write_extended_tag_from_item
# 需要导入模块: from beets.plugins import BeetsPlugin [as 别名]
# 或者: from beets.plugins.BeetsPlugin import add_media_field [as 别名]
def test_write_extended_tag_from_item(self):
plugin = BeetsPlugin()
plugin.add_media_field('customtag', field_extension)
mediafile = self._mediafile_fixture('empty')
self.assertIsNone(mediafile.customtag)
item = Item(path=mediafile.path, customtag=u'Gb')
item.write()
mediafile = MediaFile(mediafile.path)
self.assertEqual(mediafile.customtag, u'Gb')
delattr(MediaFile, 'customtag')
Item._media_fields.remove('customtag')
示例6: test_write_extended_tag_from_item
# 需要导入模块: from beets.plugins import BeetsPlugin [as 别名]
# 或者: from beets.plugins.BeetsPlugin import add_media_field [as 别名]
def test_write_extended_tag_from_item(self):
plugin = BeetsPlugin()
plugin.add_media_field('initialkey', field_extension)
mediafile = self._mediafile_fixture('empty')
self.assertEqual(mediafile.initialkey, '')
item = Item(path=mediafile.path, initialkey='Gb')
item.write()
mediafile = MediaFile(mediafile.path)
self.assertEqual(mediafile.initialkey, 'Gb')
delattr(MediaFile, 'initialkey')
Item.media_fields.remove('initialkey')