Esempio n. 1
0
def dashboard_view(request):
    # Authentication check. Users currently logged in cannot view this page.
    authentication_result = authentication_check(request)
    if authentication_result is not None:
        return authentication_result
    template_data = parse_session(request)
    # get template data from session
    template_data['profile'] = User.objects.get(username=request.user)
    template_data['dashboard'] = True
    if request.method == "POST":
        vd = request.FILES.get("audiovideo", None)
        name = request.POST.get("name")
        print(type(vd))
        path = default_storage.save('video/' + '123' + '.mp4',
                                    ContentFile(vd.read()))
        request.session['video_name'] = name
        # task = ThreadTask()
        # task.save()
        t = threading.Thread(target=longTask, args=[path, request, name])
        t.setDaemon(True)
        t.start()

        return HttpResponse(status=200)
    else:
        name = request.session['video_name']
        obj = Speech.objects.get(name=name, user=request.user)
        print("Printing")
        print(obj)
        template_data['obj'] = obj
        print(template_data['obj'].name)
        return render(request, 'dashboard.html', template_data)
Esempio n. 2
0
def myvideos(request):
    authentication_result = authentication_check(request)
    if authentication_result is not None:
        return authentication_result
    template_data = parse_session(request)
    template_data['myvideos'] = True
    all_speeches = Speech.objects.filter(user=request.user)
    template_data['videos'] = all_speeches
    return render(request, 'myvideos.html', template_data)
Esempio n. 3
0
def upload_manuscript(request):
    authentication_result = authentication_check(request)
    if authentication_result is not None:
        return authentication_result
    template_data = parse_session(request)
    video_name = template_data['video_name']
    if request.method == 'POST':
        speech_obj = Speech.objects.get(name=video_name)
        speech_obj.manuscript = request.POST.get('manuscript_text')
        speech_obj.text_sim = compareTranscripts(speech_obj.speech2text,speech_obj.manuscript)*100
        speech_obj.save()
        return HttpResponse(status=200)
Esempio n. 4
0
def show_analysis(request):
    authentication_result = authentication_check(request)
    if authentication_result is not None:
        return authentication_result
    template_data = parse_session(request)
    # get template data from session
    template_data['profile'] = User.objects.get(username=request.user)
    template_data['dashboard'] = True
    
    name = template_data['video_name']
    obj = Speech.objects.get(name = name, user = request.user)
    print("Printing")
    print(obj)
    template_data['obj'] = obj
    template_data['obj'].generated_questions_string = obj.generated_questions.split(",")
    print(template_data['obj'].name)
   
    return render(request, 'dashboard.html', template_data)