本文整理汇总了Python中mutagenx.ogg.OggPage.renumber方法的典型用法代码示例。如果您正苦于以下问题:Python OggPage.renumber方法的具体用法?Python OggPage.renumber怎么用?Python OggPage.renumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mutagenx.ogg.OggPage
的用法示例。
在下文中一共展示了OggPage.renumber方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_renumber_muxed
# 需要导入模块: from mutagenx.ogg import OggPage [as 别名]
# 或者: from mutagenx.ogg.OggPage import renumber [as 别名]
def test_renumber_muxed(self):
pages = [OggPage() for i in range(10)]
for seq, page in enumerate(pages[0:1] + pages[2:]):
page.serial = 0
page.sequence = seq
pages[1].serial = 2
pages[1].sequence = 100
data = io.BytesIO(b"".join([page.write() for page in pages]))
OggPage.renumber(data, 0, 20)
data.seek(0)
pages = [OggPage(data) for i in range(10)]
self.failUnlessEqual(pages[1].serial, 2)
self.failUnlessEqual(pages[1].sequence, 100)
pages.pop(1)
self.failUnlessEqual([page.sequence for page in pages], list(range(20, 29)))
示例2: test_renumber
# 需要导入模块: from mutagenx.ogg import OggPage [as 别名]
# 或者: from mutagenx.ogg.OggPage import renumber [as 别名]
def test_renumber(self):
self.failUnlessEqual(
[page.sequence for page in self.pages], [0, 1, 2])
fileobj = io.BytesIO()
for page in self.pages:
fileobj.write(page.write())
fileobj.seek(0)
OggPage.renumber(fileobj, 1, 10)
fileobj.seek(0)
pages = [OggPage(fileobj) for i in range(3)]
self.failUnlessEqual([page.sequence for page in pages], [10, 11, 12])
fileobj.seek(0)
OggPage.renumber(fileobj, 1, 20)
fileobj.seek(0)
pages = [OggPage(fileobj) for i in range(3)]
self.failUnlessEqual([page.sequence for page in pages], [20, 21, 22])
示例3: test_renumber_reread
# 需要导入模块: from mutagenx.ogg import OggPage [as 别名]
# 或者: from mutagenx.ogg.OggPage import renumber [as 别名]
def test_renumber_reread(self):
try:
fd, filename = tempfile.mkstemp(suffix=".ogg")
os.close(fd)
shutil.copy(os.path.join("tests", "data", "multipagecomment.ogg"),
filename)
fileobj = open(filename, "rb+")
OggPage.renumber(fileobj, 1002429366, 20)
fileobj.close()
fileobj = open(filename, "rb+")
OggPage.renumber(fileobj, 1002429366, 0)
fileobj.close()
finally:
try:
os.remove(filename)
except OSError:
pass