本文整理匯總了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)