# HG changeset patch
# User grandjoncl
# Date 1348675363 -7200
# Node ID 2ed891cf8c440b2cd0e27abf962f615166a175f4
# Parent 9bac1bd2be4b92600319058d44d1836a7e917371
Correction of embed code generator. It takes the youtube/vimeo/dailymotion player when possible.
diff -r 9bac1bd2be4b -r 2ed891cf8c44 src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_popup.html
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_popup.html Wed Sep 26 17:35:21 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_popup.html Wed Sep 26 18:02:43 2012 +0200
@@ -37,7 +37,6 @@
-
{% include "ldt/ldt_utils/partial/embed_player.html" %}
diff -r 9bac1bd2be4b -r 2ed891cf8c44 src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html Wed Sep 26 17:35:21 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html Wed Sep 26 18:02:43 2012 +0200
@@ -2,8 +2,7 @@
{% load i18n %}
{% load thumbnail %}
+
{% endspaceless %}
diff -r 9bac1bd2be4b -r 2ed891cf8c44 src/ldt/ldt/ldt_utils/urls.py
--- a/src/ldt/ldt/ldt_utils/urls.py Wed Sep 26 17:35:21 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/urls.py Wed Sep 26 18:02:43 2012 +0200
@@ -33,7 +33,7 @@
url(r'^filtercontents/_(?P[\w\%\_\-\+]*?)/$', "views.content.contents_filter",),
url(r'^filtergroups/_(?P[\w\%\_\-\+]*?)/$', "views.group.groups_filter",),
url(r'filtershare/_(?P[\w\%\_\-\+]*?)/(?Ptrue|false)$', "views.workspace.share_filter"),
- (r'^embedpopup/?$', "views.workspace.popup_embed"),
+ url(r'^embedpopup/?$', "views.workspace.popup_embed"),
url(r'^segment/(?P.*)/(?P.*)/(?P.*)/(?P.*)/(?P.*)/$', 'views.lignesdetemps.index_segment'),
url(r'^segmentInit/(?P.*)/(?P.*)/(?P.*)/(?P.*)/(?P.*)/$', 'views.lignesdetemps.init_segment'),
url(r'^segmentLdt/(?P.*)/(?P.*)/(?P.*)/(?P.*)/(?P.*)/$', 'views.lignesdetemps.ldt_segment'),
diff -r 9bac1bd2be4b -r 2ed891cf8c44 src/ldt/ldt/ldt_utils/views/workspace.py
--- a/src/ldt/ldt/ldt_utils/views/workspace.py Wed Sep 26 17:35:21 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/views/workspace.py Wed Sep 26 18:02:43 2012 +0200
@@ -24,6 +24,7 @@
import django.core.urlresolvers
import ldt.auth as ldt_auth
import lxml.etree
+import logging
@login_required
@@ -100,9 +101,18 @@
json_url = request.GET.get("json_url")
player_id = request.GET.get("player_id")
ldt_id = request.GET.get("ldt_id")
-
+
project = Project.safe_objects.get(ldt_id=ldt_id); #@UndefinedVariable
-
+ project_contents = project.contents.all()
+ content=project_contents[0]
+ external_url = None
+ if content.src is not None:
+ for external_src in settings.EXTERNAL_STREAM_SRC:
+ if external_src in content.src:
+ external_url = content.src
+ break
+ logging.debug("louisedebug : "+str(external_url))
+
stream_mode = project.stream_mode
if stream_mode != "video":
stream_mode = 'radio'
@@ -116,15 +126,17 @@
if not ldt_auth.check_access(request.user, project):
return HttpResponseForbidden(_("You can not access this project"))
- ps = ProjectSerializer(project, from_contents=False, from_display=True)
+ ps = ProjectSerializer(project, from_contents=True, from_display=True)
annotations = ps.get_annotations(first_cutting=True)
-
- rend_dict = {'json_url':json_url, 'player_id':player_id, 'annotations':annotations, 'ldt_id': ldt_id, 'stream_mode': stream_mode, 'player_width': player_width, 'player_height': player_height}
+ rend_dict = {'json_url':json_url, 'player_id':player_id, 'annotations':annotations, 'ldt_id': ldt_id, 'stream_mode': stream_mode, 'player_width': player_width, 'player_height': player_height, 'external_url': external_url}
+ #embed_rendered = dict((typestr,
+ # (lambda s:escape(lxml.etree.tostring(fragment_fromstring(render_to_string("ldt/ldt_utils/partial/embed_%s.html" % (s), rend_dict, context_instance=RequestContext(request))), pretty_print=True)))(typestr))
+ # for typestr in ('player', 'seo_body', 'seo_meta', 'links'))
+
embed_rendered = dict((typestr,
- (lambda s:escape(lxml.etree.tostring(fragment_fromstring(render_to_string("ldt/ldt_utils/partial/embed_%s.html" % (s), rend_dict, context_instance=RequestContext(request))), pretty_print=True)))(typestr))
+ (lambda s:escape(render_to_string("ldt/ldt_utils/partial/embed_%s.html" % (s), rend_dict, context_instance=RequestContext(request))))(typestr))
for typestr in ('player', 'seo_body', 'seo_meta', 'links'))
-
rend_dict['embed_rendered'] = embed_rendered
return render_to_response("ldt/ldt_utils/embed_popup.html",