本文整理汇总了Python中mutagen.asf.ASF.items方法的典型用法代码示例。如果您正苦于以下问题:Python ASF.items方法的具体用法?Python ASF.items怎么用?Python ASF.items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mutagen.asf.ASF
的用法示例。
在下文中一共展示了ASF.items方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TASFSave
# 需要导入模块: from mutagen.asf import ASF [as 别名]
# 或者: from mutagen.asf.ASF import items [as 别名]
class TASFSave(TestCase):
# https://github.com/quodlibet/mutagen/issues/81#issuecomment-207014936
original = os.path.join(DATA_DIR, "silence-1.wma")
def setUp(self):
self.filename = get_temp_copy(self.original)
self.audio = ASF(self.filename)
def tearDown(self):
os.unlink(self.filename)
def test_save_filename(self):
self.audio.save(self.audio.filename)
def test_multiple_delete(self):
self.audio["large_value1"] = "#" * 50000
self.audio.save()
audio = ASF(self.filename)
for tag in audio.keys():
del(audio[tag])
audio.save()
def test_readd_objects(self):
header = self.audio._header
del header.objects[:]
self.audio.save()
self.assertTrue(header.get_child(ContentDescriptionObject.GUID))
self.assertTrue(
header.get_child(ExtendedContentDescriptionObject.GUID))
self.assertTrue(header.get_child(HeaderExtensionObject.GUID))
ext = header.get_child(HeaderExtensionObject.GUID)
self.assertTrue(ext.get_child(MetadataObject.GUID))
self.assertTrue(ext.get_child(MetadataLibraryObject.GUID))
def test_keep_others(self):
self.audio.save()
new = ASF(self.filename)
self.assertTrue(new._header.get_child(CodecListObject.GUID))
def test_padding(self):
old_tags = sorted(self.audio.items())
def get_padding(fn):
header = ASF(fn)._header
return len(header.get_child(PaddingObject.GUID).data)
for i in [0, 1, 2, 3, 42, 100, 5000, 30432, 1]:
def padding_cb(info):
self.assertEqual(info.size, 30432)
return i
self.audio.save(padding=padding_cb)
self.assertEqual(get_padding(self.filename), i)
last = ASF(self.filename)
self.assertEqual(sorted(last.items()), old_tags)
示例2: test_padding
# 需要导入模块: from mutagen.asf import ASF [as 别名]
# 或者: from mutagen.asf.ASF import items [as 别名]
def test_padding(self):
old_tags = sorted(self.audio.items())
def get_padding(fn):
header = ASF(fn)._header
return len(header.get_child(PaddingObject.GUID).data)
for i in [0, 1, 2, 3, 42, 100, 5000, 30432, 1]:
def padding_cb(info):
self.assertEqual(info.size, 30432)
return i
self.audio.save(padding=padding_cb)
self.assertEqual(get_padding(self.filename), i)
last = ASF(self.filename)
self.assertEqual(sorted(last.items()), old_tags)