Commit 064cb036 by Tyler Hallada

Read video in unicode?

parent a744c98b
...@@ -761,8 +761,8 @@ def export_to_xml(video_ids, course_id=None, external=False, video_download_dir= ...@@ -761,8 +761,8 @@ def export_to_xml(video_ids, course_id=None, external=False, video_download_dir=
external (bool): True if first video id in `video_ids` is not edx_video_id else False external (bool): True if first video id in `video_ids` is not edx_video_id else False
video_download_dir (str): The directory to download videos files to. If None, do not video_download_dir (str): The directory to download videos files to. If None, do not
download videos. download videos.
resource_fs (???): The filesystem to download videos onto. If None, do not download resource_fs (PyFilesystem): The filesystem to download videos onto. If None, do not
videos. download videos.
Returns: Returns:
An lxml video_asset element containing export data An lxml video_asset element containing export data
...@@ -804,7 +804,7 @@ def export_to_xml(video_ids, course_id=None, external=False, video_download_dir= ...@@ -804,7 +804,7 @@ def export_to_xml(video_ids, course_id=None, external=False, video_download_dir=
exported_url = '{}/{}'.format(video_download_dir, video_url.split('/')[-1]) exported_url = '{}/{}'.format(video_download_dir, video_url.split('/')[-1])
resp = urllib2.urlopen(video_url) resp = urllib2.urlopen(video_url)
with resource_fs.open(exported_url, 'w') as f: with resource_fs.open(exported_url, 'w') as f:
f.write(resp.read()) f.write(unicode(resp.read()))
attributes['url'] = exported_url attributes['url'] = exported_url
else: else:
attributes = { attributes = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment