src/ldt/ldt/ldt_utils/views/front.py
changeset 377 a1f9f7583925
parent 364 0d1a9d5922ed
child 385 64a187532417
equal deleted inserted replaced
376:de5a44f597e9 377:a1f9f7583925
    62 
    62 
    63 @login_required
    63 @login_required
    64 def annot_content(request, content_iri_id):
    64 def annot_content(request, content_iri_id):
    65     # Get the wanted content
    65     # Get the wanted content
    66     content = Content.objects.get(iri_id=content_iri_id)
    66     content = Content.objects.get(iri_id=content_iri_id)
       
    67     # Get the content src to see if it is a youtube video
       
    68     youtube_url = None
       
    69     if content.src is not None and "youtube.com" in content.src:
       
    70         youtube_url = content.src
    67     # The main project for the content
    71     # The main project for the content
    68     proj = Project.objects.filter(contents__in=[content])[0]
    72     proj = Project.objects.filter(contents__in=[content])[0]
    69     # Vars for player
    73     # Vars for player
    70     player_id = "player_project_" + proj.ldt_id
    74     player_id = "player_project_" + proj.ldt_id
    71     
    75     
    79     is_gecko = ((request.META['HTTP_USER_AGENT'].lower().find("firefox")) > -1);
    83     is_gecko = ((request.META['HTTP_USER_AGENT'].lower().find("firefox")) > -1);
    80 
    84 
    81 
    85 
    82     return render_to_response("front/front_player.html",
    86     return render_to_response("front/front_player.html",
    83                               {'content': content, 'project':proj, 'player_id': player_id, 
    87                               {'content': content, 'project':proj, 'player_id': player_id, 
    84                               'json_url': json_url, 'player_width':player_width, 'player_height':player_height, 'stream_mode':stream_mode,
    88                               'json_url': json_url, 'player_width':player_width, 'player_height':player_height, 'stream_mode':stream_mode, 'youtube_url':youtube_url,
    85                                'is_gecko': is_gecko},
    89                                'is_gecko': is_gecko},
    86                               context_instance=RequestContext(request))
    90                               context_instance=RequestContext(request))
    87 
    91 
    88 
    92 
    89 @login_required
    93 @login_required