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


Python OggPage.packets方法代码示例

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


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

示例1: test_page_max_size

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import packets [as 别名]
 def test_page_max_size(self):
     page = OggPage()
     page.packets = ["1" * 255 * 255]
     page.complete = False
     page2 = OggPage()
     page2.packets = [""]
     page2.sequence = 1
     page2.continued = True
     self.failUnlessEqual(["1" * 255 * 255], OggPage.to_packets([page, page2]))
开发者ID:hanvo,项目名称:MusicCloud,代码行数:11,代码来源:test_ogg.py

示例2: test_packet_exactly_255

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import packets [as 别名]
 def test_packet_exactly_255(self):
     page = OggPage()
     page.packets = [b"1" * 255]
     page.complete = False
     page2 = OggPage()
     page2.packets = [b""]
     page2.sequence = 1
     page2.continued = True
     self.failUnlessEqual([b"1" * 255], OggPage.to_packets([page, page2]))
开发者ID:dmoon4117,项目名称:mutagen,代码行数:11,代码来源:test_ogg.py

示例3: test_read_max_size

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import packets [as 别名]
 def test_read_max_size(self):
     page = OggPage()
     page.packets = [b"1" * 255 * 255]
     page.complete = False
     page2 = OggPage()
     page2.packets = [b"", b"foo"]
     page2.sequence = 1
     page2.continued = True
     data = page.write() + page2.write()
     fileobj = BytesIO(data)
     self.failUnlessEqual(OggPage(fileobj), page)
     self.failUnlessEqual(OggPage(fileobj), page2)
     self.failUnlessRaises(EOFError, OggPage, fileobj)
开发者ID:Sophist-UK,项目名称:mutagen,代码行数:15,代码来源:test_ogg.py

示例4: test_theora_bad_version

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import packets [as 别名]
 def test_theora_bad_version(self):
     page = OggPage(open(self.filename, "rb"))
     packet = page.packets[0]
     packet = packet[:7] + b"\x03\x00" + packet[9:]
     page.packets = [packet]
     fileobj = cBytesIO(page.write())
     self.failUnlessRaises(IOError, OggTheoraInfo, fileobj)
开发者ID:Shutshutnunte,项目名称:mutagen,代码行数:9,代码来源:test_oggtheora.py

示例5: test_crc_py25

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import packets [as 别名]
    def test_crc_py25(self):
        # Make sure page.write can handle both signed/unsigned int
        # return values of crc32.
        # http://code.google.com/p/mutagen/issues/detail?id=63
        # http://docs.python.org/library/zlib.html#zlib.crc32

        import zlib
        old_crc = zlib.crc32

        def zlib_uint(*args):
            return (old_crc(*args) & 0xffffffff)

        def zlib_int(*args):
            return cdata.int_be(cdata.to_uint_be(old_crc(*args) & 0xffffffff))

        try:
            page = OggPage()
            page.packets = [b"abc"]
            zlib.crc32 = zlib_uint
            uint_data = page.write()
            zlib.crc32 = zlib_int
            int_data = page.write()
        finally:
            zlib.crc32 = old_crc

        self.failUnlessEqual(uint_data, int_data)
开发者ID:svetlio2,项目名称:hackbg,代码行数:28,代码来源:test_ogg.py

示例6: test_page_max_size_alone_too_big

# 需要导入模块: from mutagen.ogg import OggPage [as 别名]
# 或者: from mutagen.ogg.OggPage import packets [as 别名]
 def test_page_max_size_alone_too_big(self):
     page = OggPage()
     page.packets = [b"1" * 255 * 255]
     page.complete = True
     self.failUnlessRaises(ValueError, page.write)
开发者ID:Sophist-UK,项目名称:mutagen,代码行数:7,代码来源:test_ogg.py


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