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

Python video_module.create_youtube_string函数代码示例

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

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



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

示例1: test_create_youtube_string_missing

 def test_create_youtube_string_missing(self):
     """
     Test that Youtube IDs which aren't explicitly set aren't included in the output string.
     """
     self.descriptor.youtube_id_0_75 = 'izygArpw-Qo'
     self.descriptor.youtube_id_1_0 = 'p2Q6BrNhdh8'
     self.descriptor.youtube_id_1_25 = '1EeWXzPdhSA'
     expected = "0.75:izygArpw-Qo,1.00:p2Q6BrNhdh8,1.25:1EeWXzPdhSA"
     self.assertEqual(create_youtube_string(self.descriptor), expected)
开发者ID:Edraak,项目名称:edx-platform,代码行数:9,代码来源:test_video.py


示例2: test_create_youtube_string

 def test_create_youtube_string(self):
     """
     Test that Youtube ID strings are correctly created when writing back out to XML.
     """
     self.descriptor.youtube_id_0_75 = 'izygArpw-Qo'
     self.descriptor.youtube_id_1_0 = 'p2Q6BrNhdh8'
     self.descriptor.youtube_id_1_25 = '1EeWXzPdhSA'
     self.descriptor.youtube_id_1_5 = 'rABDYkeK0x8'
     expected = "0.75:izygArpw-Qo,1.00:p2Q6BrNhdh8,1.25:1EeWXzPdhSA,1.50:rABDYkeK0x8"
     self.assertEqual(create_youtube_string(self.descriptor), expected)
开发者ID:Edraak,项目名称:edx-platform,代码行数:10,代码来源:test_video.py


示例3: test_create_youtube_string_missing

 def test_create_youtube_string_missing(self):
     """
     Test that Youtube IDs which aren't explicitly set aren't included
     in the output string.
     """
     system = DummySystem(load_error_modules=True)
     location = Location("edX", 'course', 'run', "video", "SampleProblem1", None)
     field_data = DictFieldData({'location': location})
     descriptor = VideoDescriptor(system, field_data, Mock())
     descriptor.youtube_id_0_75 = 'izygArpw-Qo'
     descriptor.youtube_id_1_0 = 'p2Q6BrNhdh8'
     descriptor.youtube_id_1_25 = '1EeWXzPdhSA'
     expected = "0.75:izygArpw-Qo,1.00:p2Q6BrNhdh8,1.25:1EeWXzPdhSA"
     self.assertEqual(create_youtube_string(descriptor), expected)
开发者ID:jianchang653,项目名称:edx-platform,代码行数:14,代码来源:test_video.py


示例4: test_create_youtube_string

 def test_create_youtube_string(self):
     """
     Test that Youtube ID strings are correctly created when writing
     back out to XML.
     """
     system = DummySystem(load_error_modules=True)
     location = Location("edX", 'course', 'run', "video", 'SampleProblem1', None)
     field_data = DictFieldData({'location': location})
     descriptor = VideoDescriptor(system, field_data, Mock())
     descriptor.youtube_id_0_75 = 'izygArpw-Qo'
     descriptor.youtube_id_1_0 = 'p2Q6BrNhdh8'
     descriptor.youtube_id_1_25 = '1EeWXzPdhSA'
     descriptor.youtube_id_1_5 = 'rABDYkeK0x8'
     expected = "0.75:izygArpw-Qo,1.00:p2Q6BrNhdh8,1.25:1EeWXzPdhSA,1.50:rABDYkeK0x8"
     self.assertEqual(create_youtube_string(descriptor), expected)
开发者ID:jianchang653,项目名称:edx-platform,代码行数:15,代码来源:test_video.py


示例5: test_video_constructor

    def test_video_constructor(self):
        """Make sure that all parameters extracted correctly from xml"""
        context = self.item_descriptor.render('student_view').content

        sources = {
            'main': u'example.mp4',
            u'mp4': u'example.mp4',
            u'webm': u'example.webm',
        }

        expected_context = {
            'ajax_url': self.item_descriptor.xmodule_runtime.ajax_url + '/save_user_state',
            'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', False),
            'data_dir': getattr(self, 'data_dir', None),
            'display_name': u'A Name',
            'end': 3610.0,
            'id': self.item_descriptor.location.html_id(),
            'show_captions': 'true',
            'handout': None,
            'sources': sources,
            'speed': 'null',
            'general_speed': 1.0,
            'start': 3603.0,
            'saved_video_position': 0.0,
            'sub': u'a_sub_file.srt.sjson',
            'track': None,
            'youtube_streams': create_youtube_string(self.item_descriptor),
            'yt_test_timeout': 1500,
            'yt_api_url': 'www.youtube.com/iframe_api',
            'yt_test_url': 'gdata.youtube.com/feeds/api/videos/',
            'transcript_download_format': 'srt',
            'transcript_download_formats_list': [{'display_name': 'SubRip (.srt) file', 'value': 'srt'}, {'display_name': 'Text (.txt) file', 'value': 'txt'}],
            'transcript_language': u'en',
            'transcript_languages': json.dumps(OrderedDict({"en": "English", "uk":  u"Українська"})),
            'transcript_translation_url': self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, 'transcript', 'translation'
            ).rstrip('/?'),
            'transcript_available_translations_url': self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, 'transcript', 'available_translations'
            ).rstrip('/?'),
        }

        self.assertEqual(
            context,
            self.item_descriptor.xmodule_runtime.render_template('video.html', expected_context),
        )
开发者ID:PaoloC68,项目名称:edx-platform,代码行数:46,代码来源:test_video_mongo.py


示例6: test_video_constructor

    def test_video_constructor(self):
        """Make sure that all parameters extracted correctly from xml"""
        context = self.item_descriptor.render(STUDENT_VIEW).content
        sources = json.dumps([u"example.mp4", u"example.webm"])

        expected_context = {
            "ajax_url": self.item_descriptor.xmodule_runtime.ajax_url + "/save_user_state",
            "autoplay": settings.FEATURES.get("AUTOPLAY_VIDEOS", False),
            "branding_info": None,
            "license": None,
            "cdn_eval": False,
            "cdn_exp_group": None,
            "data_dir": getattr(self, "data_dir", None),
            "display_name": u"A Name",
            "end": 3610.0,
            "id": self.item_descriptor.location.html_id(),
            "show_captions": "true",
            "handout": None,
            "download_video_link": u"example.mp4",
            "sources": sources,
            "speed": "null",
            "general_speed": 1.0,
            "start": 3603.0,
            "saved_video_position": 0.0,
            "sub": u"a_sub_file.srt.sjson",
            "track": None,
            "youtube_streams": create_youtube_string(self.item_descriptor),
            "yt_test_timeout": 1500,
            "yt_api_url": "www.youtube.com/iframe_api",
            "yt_test_url": "gdata.youtube.com/feeds/api/videos/",
            "transcript_download_format": "srt",
            "transcript_download_formats_list": [
                {"display_name": "SubRip (.srt) file", "value": "srt"},
                {"display_name": "Text (.txt) file", "value": "txt"},
            ],
            "transcript_language": u"en",
            "transcript_languages": json.dumps(OrderedDict({"en": "English", "uk": u"Українська"})),
            "transcript_translation_url": self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, "transcript", "translation"
            ).rstrip("/?"),
            "transcript_available_translations_url": self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, "transcript", "available_translations"
            ).rstrip("/?"),
        }

        self.assertEqual(context, self.item_descriptor.xmodule_runtime.render_template("video.html", expected_context))
开发者ID:fjardon,项目名称:edx-platform,代码行数:46,代码来源:test_video_mongo.py


示例7: test_video_constructor

    def test_video_constructor(self):
        """Make sure that all parameters extracted correctly from xml"""
        context = self.item_descriptor.render('student_view').content

        sources = {
            'main': u'example.mp4',
            u'mp4': u'example.mp4',
            u'webm': u'example.webm',
        }

        expected_context = {
            'ajax_url': self.item_descriptor.xmodule_runtime.ajax_url + '/save_user_state',
            'autoplay': settings.FEATURES.get('AUTOPLAY_VIDEOS', False),
            'data_dir': getattr(self, 'data_dir', None),
            'display_name': u'A Name',
            'end': 3610.0,
            'id': self.item_descriptor.location.html_id(),
            'show_captions': 'true',
            'sources': sources,
            'speed': 'null',
            'general_speed': 1.0,
            'start': 3603.0,
            'saved_video_position': 0.0,
            'sub': u'a_sub_file.srt.sjson',
            'track': None,
            'youtube_streams': create_youtube_string(self.item_descriptor),
            'yt_test_timeout': 1500,
            'yt_test_url': 'https://gdata.youtube.com/feeds/api/videos/',
            'transcript_language': 'en',
            'transcript_languages': '{"en": "English", "uk": "Ukrainian"}',
            'transcript_translation_url': self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, 'transcript'
            ).rstrip('/?') + '/translation',
            'transcript_available_translations_url': self.item_descriptor.xmodule_runtime.handler_url(
                self.item_descriptor, 'transcript'
            ).rstrip('/?') + '/available_translations',
        }
        self.assertEqual(
            context,
            self.item_descriptor.xmodule_runtime.render_template('video.html', expected_context),
        )
开发者ID:Caesar73,项目名称:edx-platform,代码行数:41,代码来源:test_video_mongo.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python video_module.manage_video_subtitles_save函数代码示例发布时间:2022-05-26
下一篇:
Python validation.StudioValidation类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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