来自 edge.edx.org 的导出课程的不同视频格式
Different video format on exported course from edge.edx.org
我有一门关于 edge.edx.org 的课程和一些视频,我导出了该课程并想导入到我的 Open edX 实例 (eucalyptus.1),但我会收到此错误:
2017-11-21 04:47:42,307 ERROR 3995 [xmodule.vertical_block] vertical_block.py:122 - Unable to load child when parsing Vertical. Continuing...
Traceback (most recent call last):
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/vertical_block.py", line 119, in definition_from_xml
child_block = system.process_xml(etree.tostring(child, encoding='unicode'))
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/xml.py", line 196, in process_xml
id_manager,
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1595, in xblock_from_node
block = block_class.parse_xml(node, self, keys, id_generator)
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/xml_module.py", line 559, in parse_xml
return super(XmlParserMixin, cls).parse_xml(node, runtime, keys, id_generator) # pylint: disable=bad-super-call
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1074, in parse_xml
block = cls.from_xml(xml, runtime, id_generator)
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/video_module/video_module.py", line 527, in from_xml
field_data = cls._parse_video_xml(xml_object, id_generator)
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/video_module/video_module.py", line 788, in _parse_video_xml
course_id=course_id
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/edxval/api.py", line 508, in import_from_xml
create_video(data)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/edxval/api.py", line 104, in create_video
raise ValCannotCreateError(serializer.errors)
ValCannotCreateError: {'duration': [u'This field may not be null.'], 'edx_video_id': [u'This field may not be blank.'], 'client_video_id': [u'This field may not be null.']}
检查导出的 XML 文件中视频块的内容后,我会发现该视频块 (edx.edx.org) 与我创建并导出到我的视频的课程之间的区别本地实例 (eucalyptus.1)。来自 Edge 的视频的 XML 内容:
<video youtube="1.00:abc123123" url_name="123123123123" license="all-rights-reserved" display_name="TestVideo" download_track="true" download_video="false" edx_video_id="" html5_sources="[]" sub="abc123123" youtube_id_1_0="abc123123">
<video_asset/>
</video>
来自本地 (eucalyptus.1) 实例的视频:
<video youtube="1.00:abc123123" url_name="123123123123" license="all-rights-reserved" display_name="TestVideo" download_track="true" download_video="false" html5_sources="[]" sub="abc123123" youtube_id_1_0="abc123123"/>
我的问题是,是否可以将课程从较高版本的 edX 导入到较低版本(实际上除了视频之外的所有内容都已正确导入),如果不能,是否有已知的解决方法?
此外,如果错误指出这些字段可能不为空,那么为什么首先在导出时将它们设置为空?
看起来只从 video
XML 标签中删除 edx_video_id
属性就可以解决问题,视频可以正常导入。我创建了一个 Python 脚本,如果您发现自己处于相同情况,它会为您执行此操作:https://gist.github.com/vkaracic/ae8bb04cb684bebb9af336e822a82238
我有一门关于 edge.edx.org 的课程和一些视频,我导出了该课程并想导入到我的 Open edX 实例 (eucalyptus.1),但我会收到此错误:
2017-11-21 04:47:42,307 ERROR 3995 [xmodule.vertical_block] vertical_block.py:122 - Unable to load child when parsing Vertical. Continuing...
Traceback (most recent call last):
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/vertical_block.py", line 119, in definition_from_xml
child_block = system.process_xml(etree.tostring(child, encoding='unicode'))
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/xml.py", line 196, in process_xml
id_manager,
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1595, in xblock_from_node
block = block_class.parse_xml(node, self, keys, id_generator)
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/xml_module.py", line 559, in parse_xml
return super(XmlParserMixin, cls).parse_xml(node, runtime, keys, id_generator) # pylint: disable=bad-super-call
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/x_module.py", line 1074, in parse_xml
block = cls.from_xml(xml, runtime, id_generator)
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/video_module/video_module.py", line 527, in from_xml
field_data = cls._parse_video_xml(xml_object, id_generator)
File "/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/video_module/video_module.py", line 788, in _parse_video_xml
course_id=course_id
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/edxval/api.py", line 508, in import_from_xml
create_video(data)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/edxval/api.py", line 104, in create_video
raise ValCannotCreateError(serializer.errors)
ValCannotCreateError: {'duration': [u'This field may not be null.'], 'edx_video_id': [u'This field may not be blank.'], 'client_video_id': [u'This field may not be null.']}
检查导出的 XML 文件中视频块的内容后,我会发现该视频块 (edx.edx.org) 与我创建并导出到我的视频的课程之间的区别本地实例 (eucalyptus.1)。来自 Edge 的视频的 XML 内容:
<video youtube="1.00:abc123123" url_name="123123123123" license="all-rights-reserved" display_name="TestVideo" download_track="true" download_video="false" edx_video_id="" html5_sources="[]" sub="abc123123" youtube_id_1_0="abc123123">
<video_asset/>
</video>
来自本地 (eucalyptus.1) 实例的视频:
<video youtube="1.00:abc123123" url_name="123123123123" license="all-rights-reserved" display_name="TestVideo" download_track="true" download_video="false" html5_sources="[]" sub="abc123123" youtube_id_1_0="abc123123"/>
我的问题是,是否可以将课程从较高版本的 edX 导入到较低版本(实际上除了视频之外的所有内容都已正确导入),如果不能,是否有已知的解决方法? 此外,如果错误指出这些字段可能不为空,那么为什么首先在导出时将它们设置为空?
看起来只从 video
XML 标签中删除 edx_video_id
属性就可以解决问题,视频可以正常导入。我创建了一个 Python 脚本,如果您发现自己处于相同情况,它会为您执行此操作:https://gist.github.com/vkaracic/ae8bb04cb684bebb9af336e822a82238