enable dailymotion embed player.
authorcavaliet
Wed, 08 Feb 2012 17:36:59 +0100
changeset 543 03a99f7440ef
parent 542 54dfa397baa3
child 544 610524c5d1e3
enable dailymotion embed player.
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html
src/ldt/ldt/ldt_utils/views/front.py
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Wed Feb 08 14:00:15 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Wed Feb 08 17:36:59 2012 +0100
@@ -125,12 +125,12 @@
             }      
             ]
         },
-      {% if youtube_url %}
+      {% if external_url %}
       player:{
-    	  type:'youtube', // player type
+    	  type:{% if "youtube.com" in external_url %}'youtube'{% else %}'dailymotion'{% endif %}, // player type
           height: 300, 
           width: {{ player_width }}, 
-          video: '{{ youtube_url }}'
+          video: '{{ external_url }}'
       },
       {% else %}
       player:{
--- a/src/ldt/ldt/ldt_utils/views/front.py	Wed Feb 08 14:00:15 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/front.py	Wed Feb 08 17:36:59 2012 +0100
@@ -12,9 +12,9 @@
 
 def front_home(request):
     # Get the 3 last annotated contents
-    last_contents = Content.objects.order_by('-stat_annotation__last_annotated').exclude(stat_annotation__nb_annotations=0)[:3]
+    last_contents = Content.objects.order_by('-last_annotated').exclude(nb_annotation=0)[:3]
     # Get the most annotated contents
-    most_contents = Content.objects.order_by('-stat_annotation__nb_annotations')[:8]
+    most_contents = Content.objects.order_by('-nb_annotation')[:8]
     # Get the active groups
     active_groups = Group.objects.exclude(name=settings.PUBLIC_GROUP_NAME)[:5]
     # Get the main tag list
@@ -71,10 +71,10 @@
 def annot_content(request, content_iri_id, project_id=None, cutting_id=None):
     # Get the wanted content
     content = Content.objects.get(iri_id=content_iri_id)
-    # Get the content src to see if it is a youtube video
-    youtube_url = None
-    if content.src is not None and "youtube.com" in content.src:
-        youtube_url = content.src
+    # Get the content src to see if it is a youtube/dailymotion video
+    external_url = None
+    if content.src is not None and (("youtube.com" in content.src) or ("dailymotion.com" in content.src)):
+        external_url = content.src
         
     # If project id is not set, we get the default project for the content
     if project_id is None or project_id == "_":
@@ -110,7 +110,7 @@
 
     return render_to_response("front/front_player.html",
                               {'content': content, 'project':proj, 'player_id': player_id, 
-                              'json_url': json_url, 'player_width':player_width, 'player_height':player_height, 'stream_mode':stream_mode, 'youtube_url':youtube_url,
+                              'json_url': json_url, 'player_width':player_width, 'player_height':player_height, 'stream_mode':stream_mode, 'external_url':external_url,
                                'is_gecko': is_gecko},
                               context_instance=RequestContext(request))