Esempio n. 1
0
def video_interactive(request,
                      slug,
                      slug_c=None,
                      slug_t=None,
                      slug_private=None):
    try:
        id = int(slug[:slug.find("-")])
    except ValueError:
        raise SuspiciousOperation('Invalid video id')
    video = get_object_or_404(Video, id=id, sites=get_current_site(request))

    template_video = 'interactive/video_interactive-iframe.html' if (
        request.GET.get('is_iframe')) else 'interactive/video_interactive.html'

    interactiveVideo, created = Interactive.objects.get_or_create(video=video)

    h5p = h5p_contents.objects.get(
        title=video.title) if (video.interactive.is_interactive()) else None
    if h5p is None:
        raise Http404("Interactive video does not exist")
    score = getUserScore(h5p.content_id) if (
        request.user == video.owner or request.user.is_superuser or
        (request.user in video.additional_owners.all())) else getUserScore(
            h5p.content_id, request.user)

    try:
        id = int(slug[:slug.find("-")])
    except ValueError:
        raise SuspiciousOperation('Invalid video id')

    return render_video(request, id, slug_c, slug_t, slug_private,
                        template_video, {
                            'h5p': h5p,
                            'score': score
                        })
Esempio n. 2
0
File: views.py Progetto: ziarn/podv2
def video_enrichment(request,
                     slug,
                     slug_c=None,
                     slug_t=None,
                     slug_private=None):

    template_video = 'enrichment/video_enrichment-iframe.html' if (
        request.GET.get('is_iframe')) else 'enrichment/video_enrichment.html'

    return render_video(request, slug, slug_c, slug_t, slug_private,
                        template_video, None)
Esempio n. 3
0
def video_enrichment(request,
                     slug,
                     slug_c=None,
                     slug_t=None,
                     slug_private=None):

    template_video = 'enrichment/video_enrichment-iframe.html' if (
        request.GET.get('is_iframe')) else 'enrichment/video_enrichment.html'

    try:
        id = int(slug[:slug.find("-")])
    except ValueError:
        raise SuspiciousOperation('Invalid video id')

    return render_video(request, id, slug_c, slug_t, slug_private,
                        template_video, None)