<a tal:attributes="href api.url(api.root, '@@download_video', query={'came_from': request.url,'url':context.video_url})" class="btn">Download</a>
@view_config(name='download_video')
def dl(request):
url = request.params.get('url')
camefrom = request.params.get('came_from')
path_dir = request.registry.settings['app.download_path']
result= save_to_disk(url, path_dir)
if result:
filename = result['filename']
filepath = os.path.abspath(os.path.join(path_dir,filename))
file_exists = os.path.exists(filepath)
if file_exists:
res = FileResponse(filepath,content_type='video/mp4')
res.headers['Content-Length'] = os.path.getsize(filepath)
res.headers['Content-Disposition'] = 'attachment;filename=%s'%filename
return res
request.session.flash(_("Error downloading video, please check your network","danger"))
return HTTPFound(location=camefrom)
Hi,
what does mean "unable to serve video file"?
Please provide more info, stack trace errors, etc.
Cheers,
davide
--
You received this message because you are subscribed to the Google Groups "Kotti" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kotti+unsubscribe@googlegroups.com.
To post to this group, send email to ko...@googlegroups.com.
Visit this group at https://groups.google.com/group/kotti.
To view this discussion on the web visit https://groups.google.com/d/msgid/kotti/CAGQAffxDEPpHeq_1ZVBW2ZfAE%2BnnJk40ZKR18uy4s8O7o7wxxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.