Commit 47afc3f8 by Tyler Hallada

Don't prepend olx:// until after writing

parent ecb4fe8a
...@@ -801,12 +801,12 @@ def export_to_xml(video_ids, course_id=None, external=False, video_download_dir= ...@@ -801,12 +801,12 @@ def export_to_xml(video_ids, course_id=None, external=False, video_download_dir=
} }
if video_download_dir and resource_fs and unicode(encoded_video.profile) != u'youtube': if video_download_dir and resource_fs and unicode(encoded_video.profile) != u'youtube':
video_url = unicode(encoded_video.url) video_url = unicode(encoded_video.url)
exported_url = 'olx://{}/{}'.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)
resp = open('/dev/null') # skipping actually downloading for now because those are big files resp = open('/dev/null') # skipping actually downloading for now because those are big files
with resource_fs.open(exported_url, 'wb') as f: with resource_fs.open(exported_url, 'wb') as f:
f.write(resp.read()) f.write(resp.read())
attributes['url'] = exported_url attributes['url'] = 'olx://{}'.format(exported_url)
SubElement( SubElement(
video_el, video_el,
'encoded_video', 'encoded_video',
......
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