--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hp/admin.py Wed Nov 14 16:29:01 2012 +0100
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+'''
+Created on Nov 13, 2012
+
+@author: ymh
+'''
+
+from django.contrib import admin
+from .models import VideoKCRel
+from .forms import VideoKCRelForm
+
+class VideoKCRelAdmin(admin.ModelAdmin):
+ form = VideoKCRelForm
+
+admin.site.register(VideoKCRel, VideoKCRelAdmin)
--- a/src/hp/context_processors.py Tue Nov 13 16:37:47 2012 +0100
+++ b/src/hp/context_processors.py Wed Nov 14 16:29:01 2012 +0100
@@ -5,6 +5,7 @@
@author: ymh
'''
from . import get_version
+from . import settings
def hp_context(request):
- return {'VERSION' : get_version()}
\ No newline at end of file
+ return {'VERSION' : get_version(), 'LDT_URL' : settings.LDT_URL, 'LDT_STATIC_URL' : settings.LDT_STATIC_URL}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hp/forms.py Wed Nov 14 16:29:01 2012 +0100
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+'''
+Created on Nov 14, 2012
+
+@author: ymh
+'''
+
+from django import forms
+from .models import VideoKCRel
+import requests
+from . import settings
+
+class VideoKCRelForm(forms.ModelForm):
+
+ iri_id = forms.CharField(max_length=255, widget=forms.widgets.Select())
+
+ def __init__(self, *args, **kwargs):
+ super(VideoKCRelForm, self).__init__(*args, **kwargs)
+
+ url = settings.LDT_API_URL + "contents/"
+ #limit=20&offset=20
+ r = requests.get(url)
+ self.fields['iri_id'].widget.choices = [(content['iri_id'], content['title']) for content in r.json['objects']]
+
+ class Meta:
+ model = VideoKCRel
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hp/migrations/0001_initial.py Wed Nov 14 16:29:01 2012 +0100
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Adding model 'VideoKCRel'
+ db.create_table('hp_videokcrel', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('iri_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)),
+ ('graph_id', self.gf('django.db.models.fields.CharField')(max_length=1024)),
+ ('topic_id', self.gf('django.db.models.fields.CharField')(max_length=1024)),
+ ))
+ db.send_create_signal('hp', ['VideoKCRel'])
+
+
+ def backwards(self, orm):
+ # Deleting model 'VideoKCRel'
+ db.delete_table('hp_videokcrel')
+
+
+ models = {
+ 'hp.videokcrel': {
+ 'Meta': {'object_name': 'VideoKCRel'},
+ 'graph_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'iri_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
+ 'topic_id': ('django.db.models.fields.CharField', [], {'max_length': '1024'})
+ }
+ }
+
+ complete_apps = ['hp']
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hp/models.py Wed Nov 14 16:29:01 2012 +0100
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+'''
+Created on Nov 13, 2012
+
+@author: ymh
+'''
+
+from django.db import models
+from django.utils.translation import ugettext_lazy as _
+
+class VideoKCRel(models.Model):
+
+ iri_id = models.CharField(max_length=255, unique=True, verbose_name=_('content.iri_id'))
+ graph_id = models.CharField(max_length=1024, verbose_name=_('graph_id'))
+ topic_id = models.CharField(max_length=1024, verbose_name=_('topic_id'))
+
+ def __unicode__(self):
+ return u"%s->%s|%s" %(self.iri_id,self.graph_id, self.topic_id)
+
+
--- a/src/hp/settings.py Tue Nov 13 16:37:47 2012 +0100
+++ b/src/hp/settings.py Wed Nov 14 16:29:01 2012 +0100
@@ -164,7 +164,16 @@
}
LDT_DOMAIN = 'http://localhost'
-LDT_API_URL = LDT_DOMAIN + '/~ymh/hp_ldt/ldtplatform/api/ldt/1.0/'
+LDT_BASE_URL = LDT_DOMAIN + '/~ymh/hp_ldt/'
+LDT_URL = LDT_BASE_URL + "ldtplatform/"
+LDT_API_URL = LDT_URL + 'api/ldt/1.0/'
+LDT_STATIC_URL = LDT_BASE_URL + "static/site/"
+
+KC_URL = 'http://176.32.94.234/kn-concierge/'
+
from .config import * #@UnusedWildImport
+
+
+
--- a/src/hp/templates/hp/partial/embed_player.html Tue Nov 13 16:37:47 2012 +0100
+++ b/src/hp/templates/hp/partial/embed_player.html Wed Nov 14 16:29:01 2012 +0100
@@ -5,104 +5,63 @@
<div>
<div id="{{ player_id }}_embed" class="iri_player_embed">
</div>
-<script type="text/javascript" src="{{WEB_URL}}{{LDT_MEDIA_PREFIX}}metadataplayer/LdtPlayer-core.js"></script>
+<script type="text/javascript" src="{{LDT_STATIC_URL}}ldt/metadataplayer/LdtPlayer-core.js"></script>
<script type="text/javascript">
-if (typeof jQuery == "undefined") {
- jQuery = IriSP.jQuery;
-}
- var metadatas = {metadata: {url: '{{json_url}}'}};
- var metadata_key = "metadata";
-
-IriSP.libFiles.defaultDir = "{% static "hp/js/" %}";
-IriSP.libFiles.locations.jwPlayerSWF = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}swf/player.swf";
-IriSP.libFiles.locations.recordMicSwf = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}swf/record_mic.swf";
-IriSP.libFiles.locations.zeroClipboardSwf = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}swf/ZeroClipboard10.swf";
-IriSP.libFiles.locations.cssjQueryUI = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}css/jq-css/themes/base/jquery-ui.css"
-IriSP.language = '{{LANGUAGE_CODE}}';
-
-IriSP.widgetsDir = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}metadataplayer";
-var _metadata = {
- url: metadatas[metadata_key].url + '?callback=?',
- format: 'ldt'
-};
-var _config = {
- width: '{{ player_width }}',
- container: '{{ player_id }}_embed',
- css: '{{WEB_URL}}{{LDT_MEDIA_PREFIX}}metadataplayer/LdtPlayer-core.css',
- default_options: {
- metadata: _metadata
- },
- widgets: [
- {
- type: "AutoPlayer",
- {% if external_url %}
- video: "{{ external_url }}",
- {% else %}
- streamer: function(_url) {
- var _matches = _url.match(/^[^\/]+\/\/[^\/]+\/[^\/]+\//);
- if (_matches) {
- return _matches[0];
- } else {
- return _url;
- }
- },
- {% endif %}
- height: 300,
- autostart: true
- },
- {
- type: "Polemic"
- {% if polemic == 'all' %}
- ,annotation_type: false
- {% endif %}
- },
- {% if polemic != 'all' %}
- {
- type: "Sparkline"
- },
- {% endif %}
- {
- type: "Slider"
- },{
- type: "AnnotationsList",
- container: "AnnotationsList_ext",
- ajax_url: "",
- ajax_granularity : 300000,
- default_thumbnail : "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}/imgs/video_sequence.png",
- show_audio: true,
- rtmp_streamer: "rtmp://media.iri.centrepompidou.fr/ddc_micro_record/"
- },{
- type: "Controller"
- },{
- type: "Segments",
- annotation_type: ["chap","découpage"]
- },{
- type: "Annotation",
- start_minimized: true,
- site_name : "Lignes de Temps",
- annotation_type: ["chap","découpage"]
- },{
- type: "Tweet",
- hide_timeout: 5000
- },{
- type: "Slideshare",
- container: "Slideshare_ext",
- embed_width: 400,
- embed_height: 334,
- annotation_type: "slide"
- },{
- type: "Mediafragment"
- },{
- type: "Social",
- container: "Social_ext",
- url: document.location.href.replace(/#.*$/,""),
- text: document.title
- }
- ]
-};
-
-_myPlayer = new IriSP.Metadataplayer(_config);
+ IriSP.libFiles.defaultDir = "libs/";
+ IriSP.language = '{{LANGUAGE_CODE}}';
+ IriSP.widgetsDir = "metadataplayer";
+ var _metadata = {
+ url: '{{LDT_URL}}ldt/cljson/id/{{project_id}}?callback=?',
+ format: 'ldt'
+ };
+ var _config = {
+ width : 480,
+ container : 'LdtPlayer',
+ default_options: {
+ metadata: _metadata
+ },
+ css : '{{LDT_STATIC_URL}}ldt/metadataplayer/LdtPlayer-core.css',
+ widgets: [
+ {
+ type: "JwpPlayer",
+ live: true,
+ height: 310,
+ width: 480,
+ provider: "rtmp",
+ streamer: function(_url) {
+ var _matches = _url.match(/^[^\/]+\/\/[^\/]+\/[^\/]+\//);
+ if (_matches) {
+ return _matches[0];
+ } else {
+ return _url;
+ }
+ }
+ },
+ { type: "Slider" },
+ { type: "Controller" },
+ { type: "Polemic" },
+ { type: "Segments" },
+ { type: "Arrow" },
+ {
+ type: "Annotation",
+ search_on_tag_click: false,
+ start_minimized: false
+ },
+ { type: "Tweet" },
+ {
+ type: "KnowledgeConcierge",
+ container: "KcContainer",
+ proxy: "{% url kc_proxy '' %}",
+ width: 480,
+ height: 420,
+ project_id: "{{kc_id}}",
+ topic_id: "{{topic_id}}"
+ }
+ ]
+ };
+ var _myPlayer = new IriSP.Metadataplayer(_config);
</script>
</div>
{% endspaceless %}
+
--- a/src/hp/urls.py Tue Nov 13 16:37:47 2012 +0100
+++ b/src/hp/urls.py Wed Nov 14 16:29:01 2012 +0100
@@ -10,6 +10,7 @@
# url(r'^hp/', include('hp.foo.urls')),
url(r'^$', 'hp.views.all_videos', name='home'),
url(r'^video/(?P<content_id>.*)$', 'hp.views.show_video_details', name='video_details'),
+ url(r'^kc_proxy/(?P<path>.*)$', 'hp.views.kc_proxy', name='kc_proxy'),
url(r'^api/1.0/', include('hp.api.urls')),
--- a/src/hp/views.py Tue Nov 13 16:37:47 2012 +0100
+++ b/src/hp/views.py Wed Nov 14 16:29:01 2012 +0100
@@ -4,11 +4,13 @@
@author: ymh
'''
+from django.conf import settings
from django.shortcuts import render_to_response
from django.template.context import RequestContext
+from django.http import HttpResponse
+from hp.models import VideoKCRel
+import logging
import requests
-from django.conf import settings
-import logging
import urlparse
logger = logging.getLogger(__name__)
@@ -41,5 +43,37 @@
r_content = requests.get(url_content)
logger.debug(r_content.text)
+
+ content = r_content.json
+ project_url = content['front_project']
+ project_path = urlparse.urlparse(project_url).path
+ project_id = ""
+ if project_path:
+ project_path_parts = project_path.split("/")
+ project_id = project_path_parts[-1] if project_path_parts[-1] else project_path_parts[-2]
+
+ kc_id = None
+ topic_id = None
+
+ kc_relation_list = list(VideoKCRel.objects.filter(iri_id=content_id)[:1])
+
+ if len(kc_relation_list) > 0:
+ kc_id = kc_relation_list[0].graph_id
+ topic_id = kc_relation_list[0].topic_id
+
+ return render_to_response(
+ 'hp/video_player.html',
+ {'content':content, 'project_id': project_id, 'kc_id': kc_id, 'topic_id': topic_id},
+ context_instance=RequestContext(request))
- return render_to_response('hp/video_player.html',{'content':r_content.json}, context_instance=RequestContext(request))
\ No newline at end of file
+
+def kc_proxy(request, path):
+
+ url = settings.KC_URL + path
+
+ data = request.POST if request.method=="POST" else {}
+
+ r = requests.request(request.method, url, data=data)
+
+ return HttpResponse(content=r.text, content_type='application/json;charset=UTF-8')
+
\ No newline at end of file
Binary file virtualenv/res/src/ldt-1.30.tar.gz has changed