当前位置: 首页>>代码示例>>Python>>正文


Python OggPage.find_last方法代码示例

本文整理汇总了Python中mutagen.ogg.OggPage.find_last方法的典型用法代码示例。如果您正苦于以下问题:Python OggPage.find_last方法的具体用法?Python OggPage.find_last怎么用?Python OggPage.find_last使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mutagen.ogg.OggPage的用法示例。


在下文中一共展示了OggPage.find_last方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_find_last_none_finishing_mux

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import find_last [as 别名]
    def test_find_last_none_finishing_mux(self):
        page1 = OggPage()
        page1.last = True
        page1.position = -1
        page2 = OggPage()
        page2.serial = page1.serial + 1
        pages = [page1, page2]
        data = BytesIO(b"".join([page.write() for page in pages]))

        assert OggPage.find_last(data, page1.serial, finishing=True) is None
        assert OggPage.find_last(data, page2.serial, finishing=True) == page2
开发者ID:quodlibet,项目名称:mutagen,代码行数:13,代码来源:test_ogg.py

示例2: test_find_last_last_empty

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import find_last [as 别名]
 def test_find_last_last_empty(self):
     # https://github.com/quodlibet/mutagen/issues/308
     pages = [OggPage() for i in xrange(10)]
     for i, page in enumerate(pages):
         page.sequence = i
         page.position = i
     pages[-1].last = True
     pages[-1].position = -1
     data = BytesIO(b"".join([page.write() for page in pages]))
     page = OggPage.find_last(data, pages[-1].serial, finishing=True)
     assert page is not None
     assert page.position == 8
     page = OggPage.find_last(data, pages[-1].serial, finishing=False)
     assert page is not None
     assert page.position == -1
开发者ID:quodlibet,项目名称:mutagen,代码行数:17,代码来源:test_ogg.py

示例3: _post_tags

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import find_last [as 别名]
    def _post_tags(self, fileobj):
        """Raises ogg.error"""

        page = OggPage.find_last(fileobj, self.serial)
        if page is None:
            raise OggVorbisHeaderError
        self.length = page.position / float(self.sample_rate)
开发者ID:YipYup,项目名称:headphones,代码行数:9,代码来源:oggvorbis.py

示例4: test_find_last_really_last

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.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 = BytesIO(bytearray().join([page.write() for page in pages]))
     self.failUnlessEqual(
         OggPage.find_last(data, pages[0].serial), pages[-1])
开发者ID:Sophist-UK,项目名称:mutagen,代码行数:9,代码来源:test_ogg.py

示例5: test_find_last

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import find_last [as 别名]
 def test_find_last(self):
     pages = [OggPage() for i in xrange(10)]
     for i, page in enumerate(pages):
         page.sequence = i
     data = BytesIO(b"".join([page.write() for page in pages]))
     self.failUnlessEqual(
         OggPage.find_last(data, pages[0].serial), pages[-1])
开发者ID:douglaskastle,项目名称:mutagen,代码行数:9,代码来源:test_ogg.py

示例6: _post_tags

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import find_last [as 别名]
 def _post_tags(self, fileobj):
     if self.length:
         return
     page = OggPage.find_last(fileobj, self.serial, finishing=True)
     if page is None:
         raise OggFLACHeaderError
     self.length = page.position / float(self.sample_rate)
开发者ID:2216288075,项目名称:meiduo_project,代码行数:9,代码来源:oggflac.py

示例7: test_find_last_single_muxed

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import find_last [as 别名]
 def test_find_last_single_muxed(self):
     page1 = OggPage()
     page1.last = True
     page2 = OggPage()
     page2.serial = page1.serial + 1
     pages = [page1, page2]
     data = BytesIO(b"".join([page.write() for page in pages]))
     assert OggPage.find_last(data, page2.serial).serial == page2.serial
开发者ID:quodlibet,项目名称:mutagen,代码行数:10,代码来源:test_ogg.py

示例8: test_find_last_muxed

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import find_last [as 别名]
 def test_find_last_muxed(self):
     pages = [OggPage() for i in range(10)]
     for i, page in enumerate(pages): page.sequence = i
     pages[-2].last = True
     pages[-1].serial = pages[0].serial + 1
     data = StringIO("".join([page.write() for page in pages]))
     self.failUnlessEqual(
         OggPage.find_last(data, pages[0].serial), pages[-2])
开发者ID:Knio,项目名称:tag2itunes,代码行数:10,代码来源:test_ogg.py

示例9: _post_tags

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import find_last [as 别名]
 def _post_tags(self, fileobj):
     page = OggPage.find_last(fileobj, self.serial)
     if page is None:
         raise OggTheoraHeaderError
     position = page.position
     mask = (1 << self.granule_shift) - 1
     frames = (position >> self.granule_shift) + (position & mask)
     self.length = frames / float(self.fps)
开发者ID:KirillMysnik,项目名称:Source.Python,代码行数:10,代码来源:oggtheora.py

示例10: load

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import find_last [as 别名]
 def load(self, fp):
     self.filename = fp.name
     fileobj = fp
     try:
         try:
             self.info = self._Info(fileobj)
             self.tags = self._Tags(fileobj, self.info)
             if self.info.length:
                 return
             last_page = OggPage.find_last(fileobj, self.info.serial)
             samples = last_page.position
             try:
                 denom = self.info.sample_rate
             except AttributeError:
                 denom = self.info.fps
             self.info.length = samples / float(denom)
         except OggError, e:
             raise self._Error, e, sys.exc_info()[2]
         except EOFError:
             raise self._Error, "no appropriate stream found"
开发者ID:rtucker,项目名称:django-mediastream,代码行数:22,代码来源:mediainspector.py

示例11: _post_tags

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.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 / float(self.fps)
开发者ID:AMOboxTV,项目名称:AMOBox.LegoBuild,代码行数:8,代码来源:oggtheora.py

示例12: _post_tags

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.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 / self.sample_rate
开发者ID:fourth-4,项目名称:mutagen,代码行数:7,代码来源:oggflac.py

示例13: _post_tags

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import find_last [as 别名]
 def _post_tags(self, fileobj):
     page = OggPage.find_last(fileobj, self.serial)
     self.length = page.position / float(self.sample_rate)
开发者ID:4everGhost,项目名称:PlexKodiConnect,代码行数:5,代码来源:oggspeex.py

示例14: _post_tags

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import find_last [as 别名]
 def _post_tags(self, fileobj):
     page = OggPage.find_last(fileobj, self.serial)
     if page is None:
         raise OggSpeexHeaderError
     self.length = page.position / float(self.sample_rate)
开发者ID:YipYup,项目名称:headphones,代码行数:7,代码来源:oggspeex.py

示例15: _post_tags

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.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) / float(48000)
开发者ID:Begall,项目名称:headphones,代码行数:5,代码来源:oggopus.py


注:本文中的mutagen.ogg.OggPage.find_last方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。