来自edge.edx.org的导出课程的不同视频格式

时间:2017-11-21 09:57:49

标签: xml video edx openedx

我在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中的课程导入较低版本(除了视频之外的所有内容实际上都是正确导入的),如果没有,是否有一个已知的解决方法? 此外,如果错误表明这些字段可能不为null,那么为什么它们首先在导出时设置为null?

1 个答案:

答案 0 :(得分:0)

看起来只删除edx_video_id XML标记中的video属性可以解决问题并正常导入视频。我创建了一个Python脚本,如果您发现自己处于相同的情况,它将为您执行此操作:https://gist.github.com/vkaracic/ae8bb04cb684bebb9af336e822a82238