• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pycaption.DFXPReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pycaption.DFXPReader的典型用法代码示例。如果您正苦于以下问题:Python DFXPReader类的具体用法?Python DFXPReader怎么用?Python DFXPReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: test_individual_timings_of_captions_with_matching_timespec_are_kept

 def test_individual_timings_of_captions_with_matching_timespec_are_kept(self):  # noqa
     captionset = DFXPReader().read(
         SAMPLE_DFXP_MULTIPLE_CAPTIONS_WITH_THE_SAME_TIMING
     )
     expected_timings = [(9209000, 12312000)] * 3
     actual_timings = [(c_.start, c_.end) for c_ in
                       captionset.get_captions('en-US')]
     self.assertEqual(expected_timings, actual_timings)
开发者ID:jpenney,项目名称:pycaption,代码行数:8,代码来源:test_dfxp.py


示例2: test_merge_concurrent_captions

    def test_merge_concurrent_captions(self):
        caption_set = DFXPReader().read(DFXP_WITH_CONCURRENT_CAPTIONS)
        captions = caption_set.get_captions('en-US')
        self.assertEqual(len(captions), 5)

        caption_set = merge_concurrent_captions(caption_set)
        captions = caption_set.get_captions('en-US')
        self.assertEqual(len(captions), 3)
开发者ID:MagikVision,项目名称:pycaption,代码行数:8,代码来源:test_functions.py


示例3: test_properly_converts_timing

 def test_properly_converts_timing(self):
     caption_set = DFXPReader().read(
         DFXP_WITH_ALTERNATIVE_TIMING_FORMATS)
     caps = caption_set.get_captions('en-US')
     self.assertEqual(caps[0].start, 1900000)
     self.assertEqual(caps[0].end, 3050000)
     self.assertEqual(caps[1].start, 4000000)
     self.assertEqual(caps[1].end, 5200000)
开发者ID:MagikVision,项目名称:pycaption,代码行数:8,代码来源:test_dfxp.py


示例4: test_proper_xml_entity_escaping

 def test_proper_xml_entity_escaping(self):
     caption_set = DFXPReader().read(DFXP_WITH_ESCAPED_APOSTROPHE)
     cue_text = caption_set.get_captions(u'en-US')[0].nodes[0].content
     self.assertEqual(
         cue_text, u"<< \"Andy's Caf\xe9 & Restaurant\" this way")
     result = DFXPWriter().write(caption_set)
     self.assertIn(
         u"&lt;&lt; \"Andy's Café &amp; Restaurant\" this way",
         result
     )
开发者ID:MagikVision,项目名称:pycaption,代码行数:10,代码来源:test_dfxp_conversion.py


示例5: test_individual_layouts_of_captions_with_matching_timespec_are_kept

    def test_individual_layouts_of_captions_with_matching_timespec_are_kept(self):  # noqa
        captionset = DFXPReader().read(
            SAMPLE_DFXP_MULTIPLE_CAPTIONS_WITH_THE_SAME_TIMING
        )
        expected_layouts = [
            (((10, u'%'), (10, u'%')), None, None, (u'center', u'bottom')),
            (((40, u'%'), (40, u'%')), None, None, (u'center', u'bottom')),
            (((10, u'%'), (70, u'%')), None, None, (u'center', u'bottom'))]
        actual_layouts = [c_.layout_info.serialized() for c_ in
                          captionset.get_captions('en-US')]

        self.assertEqual(expected_layouts, actual_layouts)
开发者ID:jpenney,项目名称:pycaption,代码行数:12,代码来源:test_dfxp.py


示例6: test_individual_texts_of_captions_with_matching_timespec_are_kept

    def test_individual_texts_of_captions_with_matching_timespec_are_kept(self):  # noqa
        captionset = DFXPReader().read(
            SAMPLE_DFXP_MULTIPLE_CAPTIONS_WITH_THE_SAME_TIMING
        )

        expected_texts = [u'Some text here',
                          u'Some text there',
                          u'Caption texts are everywhere!']
        actual_texts = [c_.nodes[0].content for c_ in
                        captionset.get_captions("en-US")]

        self.assertEqual(expected_texts, actual_texts)
开发者ID:jpenney,项目名称:pycaption,代码行数:12,代码来源:test_dfxp.py


示例7: test_individual_layouts_of_captions_with_matching_timespec_are_kept

    def test_individual_layouts_of_captions_with_matching_timespec_are_kept(self):  # noqa
        captionset = DFXPReader().read(
            SAMPLE_DFXP_MULTIPLE_CAPTIONS_WITH_THE_SAME_TIMING
        )
        expected_layouts = [
            (((10, UnitEnum.PERCENT), (10, UnitEnum.PERCENT)), None, None, (HorizontalAlignmentEnum.CENTER, VerticalAlignmentEnum.BOTTOM)),
            (((40, UnitEnum.PERCENT), (40, UnitEnum.PERCENT)), None, None, (HorizontalAlignmentEnum.CENTER, VerticalAlignmentEnum.BOTTOM)),
            (((10, UnitEnum.PERCENT), (70, UnitEnum.PERCENT)), None, None, (HorizontalAlignmentEnum.CENTER, VerticalAlignmentEnum.BOTTOM))]
        actual_layouts = [c_.layout_info.serialized() for c_ in
                          captionset.get_captions('en-US')]

        self.assertEqual(expected_layouts, actual_layouts)
开发者ID:mwx-limited,项目名称:pycaption,代码行数:12,代码来源:test_dfxp.py


示例8: test_offset_time

 def test_offset_time(self):
     reader = DFXPReader()
     self.assertEqual(1, reader._translate_time("0.001ms"))
     self.assertEqual(2000, reader._translate_time("2ms"))
     self.assertEqual(1000000, reader._translate_time("1s"))
     self.assertEqual(1234567, reader._translate_time("1.234567s"))
     self.assertEqual(180000000, reader._translate_time("3m"))
     self.assertEqual(14400000000, reader._translate_time("4h"))
     # Tick values are not supported
     self.assertRaises(
         InvalidInputError, reader._translate_time, "2.3t")
开发者ID:mwx-limited,项目名称:pycaption,代码行数:11,代码来源:test_dfxp.py


示例9: test_invalid_markup_is_properly_handled

 def test_invalid_markup_is_properly_handled(self):
     captions = DFXPReader().read(SAMPLE_DFXP_SYNTAX_ERROR.decode(u'utf-8'))
     self.assertEquals(2, len(captions.get_captions(u"en-US")))
开发者ID:jpenney,项目名称:pycaption,代码行数:3,代码来源:test_dfxp.py


示例10: test_proper_timestamps

    def test_proper_timestamps(self):
        captions = DFXPReader().read(SAMPLE_DFXP.decode(u'utf-8'))
        paragraph = captions.get_captions(u"en-US")[2]

        self.assertEquals(17000000, paragraph.start)
        self.assertEquals(18752000, paragraph.end)
开发者ID:jpenney,项目名称:pycaption,代码行数:6,代码来源:test_dfxp.py


示例11: test_caption_length

 def test_caption_length(self):
     captions = DFXPReader().read(SAMPLE_DFXP.decode(u'utf-8'))
     self.assertEquals(8, len(captions.get_captions(u"en-US")))
开发者ID:jpenney,项目名称:pycaption,代码行数:3,代码来源:test_dfxp.py


示例12: test_caption_length

 def test_caption_length(self):
     captions = DFXPReader().read(SAMPLE_DFXP)
     self.assertEquals(7, len(captions.get_captions(u"en-US")))
开发者ID:MagikVision,项目名称:pycaption,代码行数:3,代码来源:test_dfxp.py


示例13: test_empty_cue

 def test_empty_cue(self):
     caption_set = DFXPReader().read(
         SAMPLE_DFXP_EMPTY_CUE)
     caps = caption_set.get_captions('en-US')
     self.assertEquals(caps[1], [])
开发者ID:clovis818,项目名称:pycaption,代码行数:5,代码来源:test_dfxp.py


示例14: test_proper_pcc_format

    def test_proper_pcc_format(self):
        captions = DFXPReader().read(SAMPLE_DFXP)

        self.assertEquals(set(["captions", "styles"]), set(captions.keys()))
        self.assertEquals(7, len(captions["captions"]["en-US"]))
开发者ID:DramaFever,项目名称:pycaption,代码行数:5,代码来源:test_dfxp.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pycaption.SCCReader类代码示例发布时间:2022-05-25
下一篇:
Python pycap.PropertyTree类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap