本文整理汇总了Python中mutagenx.ogg.OggPage.find_last方法的典型用法代码示例。如果您正苦于以下问题:Python OggPage.find_last方法的具体用法?Python OggPage.find_last怎么用?Python OggPage.find_last使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mutagenx.ogg.OggPage
的用法示例。
在下文中一共展示了OggPage.find_last方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_find_last_no_serial
# 需要导入模块: from mutagenx.ogg import OggPage [as 别名]
# 或者: from mutagenx.ogg.OggPage import find_last [as 别名]
def test_find_last_no_serial(self):
pages = [OggPage() for i in range(10)]
for i, page in enumerate(pages):
page.sequence = i
data = io.BytesIO(b"".join([page.write() for page in pages]))
self.failUnless(OggPage.find_last(data, pages[0].serial + 1) is None)
示例2: test_find_last_really_last
# 需要导入模块: from mutagenx.ogg import OggPage [as 别名]
# 或者: from mutagenx.ogg.OggPage import find_last [as 别名]
def test_find_last_really_last(self):
pages = [OggPage() for i in range(10)]
pages[-1].last = True
for i, page in enumerate(pages):
page.sequence = i
data = io.BytesIO(b"".join([page.write() for page in pages]))
self.failUnlessEqual(
OggPage.find_last(data, pages[0].serial), pages[-1])
示例3: _post_tags
# 需要导入模块: from mutagenx.ogg import OggPage [as 别名]
# 或者: from mutagenx.ogg.OggPage import find_last [as 别名]
def _post_tags(self, fileobj):
page = OggPage.find_last(fileobj, self.serial)
self.length = page.position / self.sample_rate
示例4: _post_tags
# 需要导入模块: from mutagenx.ogg import OggPage [as 别名]
# 或者: from mutagenx.ogg.OggPage import find_last [as 别名]
def _post_tags(self, fileobj):
page = OggPage.find_last(fileobj, self.serial)
position = page.position
mask = (1 << self.granule_shift) - 1
frames = (position >> self.granule_shift) + (position & mask)
self.length = frames / self.fps
示例5: test_find_last_invalid_sync
# 需要导入模块: from mutagenx.ogg import OggPage [as 别名]
# 或者: from mutagenx.ogg.OggPage import find_last [as 别名]
def test_find_last_invalid_sync(self):
data = io.BytesIO(b"if you think this is an OggS, you're crazy")
page = OggPage.find_last(data, 0)
self.failIf(page)
示例6: _post_tags
# 需要导入模块: from mutagenx.ogg import OggPage [as 别名]
# 或者: from mutagenx.ogg.OggPage import find_last [as 别名]
def _post_tags(self, fileobj):
page = OggPage.find_last(fileobj, self.serial)
self.length = (page.position - self.__pre_skip) / 48000
示例7: _post_tags
# 需要导入模块: from mutagenx.ogg import OggPage [as 别名]
# 或者: from mutagenx.ogg.OggPage import find_last [as 别名]
def _post_tags(self, fileobj):
if self.length:
return
page = OggPage.find_last(fileobj, self.serial)
self.length = page.position / float(self.sample_rate)