def video_caption_maker_save(request, video): video_folder, created = UserFolder.objects.get_or_create( name=video.slug, owner=request.user) if (request.method == "POST"): cur_folder = get_current_session_folder(request) response = file_edit_save(request, cur_folder) if b'list_element' in response.content: messages.add_message(request, messages.INFO, _(u'The file has been saved.')) else: messages.add_message(request, messages.WARNING, _(u'The file has not been saved.')) form_caption = TrackForm(initial={'video': video}) return render( request, 'video_caption_maker.html', { 'current_folder': video_folder, 'form_make_caption': form_caption, 'video': video })
def video_caption_maker_save(request, video): video_folder, created = UserFolder.objects.get_or_create( name=video.slug, owner=request.user) if request.method == "POST": lang = request.POST.get("lang") cur_folder = get_current_session_folder(request) response = file_edit_save(request, cur_folder) response_data = json.loads(response.content) if ("list_element" in response_data) and (lang in LANG_CHOICES_DICT): captFile = get_object_or_404(CustomFileModel, id=response_data["file_id"]) # immediately assign the newly created captions file to the video desired = Track.objects.filter(video=video, src=captFile) if desired.exists(): desired.update(lang=lang, src=captFile) else: Track( video=video, kind="captions", lang=lang, src=captFile, ).save() messages.add_message(request, messages.INFO, _(u"The file has been saved.")) else: messages.add_message(request, messages.WARNING, _(u"The file has not been saved.")) form_caption = TrackForm(initial={"video": video}) return render( request, "video_caption_maker.html", { "current_folder": video_folder, "form_make_caption": form_caption, "video": video, }, )
def video_caption_maker_save(request, video): video_folder, created = UserFolder.objects.get_or_create( name=video.slug, owner=request.user ) if request.method == "POST": cur_folder = get_current_session_folder(request) response = file_edit_save(request, cur_folder) if b"list_element" in response.content: messages.add_message(request, messages.INFO, _(u"The file has been saved.")) else: messages.add_message( request, messages.WARNING, _(u"The file has not been saved.") ) form_caption = TrackForm(initial={"video": video}) return render( request, "video_caption_maker.html", { "current_folder": video_folder, "form_make_caption": form_caption, "video": video, }, )