Search code examples
xmlvideoedxopenedx

Different video format on exported course from edge.edx.org


I have a course on edge.edx.org with some videos, and I exported the course and wanted to import to my Open edX instance (eucalyptus.1) but I would get this error:

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.']}

Upon inspecting the content of the video block in the exported XML file, I would see the differences between that one (edx.edx.org) and a course with video that I created and exported on my local instance (eucalyptus.1). The XML content for the video from Edge:

<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>

Video from local (eucalyptus.1) instance:

<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"/>

My question is, is it possible to import courses from a higher version of edX to a lower one (everything except the videos are imported correctly actually), and if not, is there a known workaround for this? Also, if the error says that the those fields may not be null, why are they set to null on the export in the first place?


Solution

  • Looks like only removing the edx_video_id attribute from the video XML tags fixes the issue and the videos are imported normally. I created a Python script that will do that for you if you find yourself in the same situation: https://gist.github.com/vkaracic/ae8bb04cb684bebb9af336e822a82238