--- a/web/eulalie/templates/eulalie/partial/embed.html Mon Jun 14 15:23:07 2010 +0200
+++ b/web/eulalie/templates/eulalie/partial/embed.html Tue Jun 15 00:25:30 2010 +0200
@@ -1,5 +1,5 @@
<div id="{{ player_id }}">
</div>
<script type="text/javascript">
- playerLdt(550,310, "http://web.iri.centrepompidou.fr/eulalie/eulalie/{{ json_url }}","{{ player_id }}","/eulalie/static/swf/player.swf");
+ playerLdt(550,310, "{{ json_url }}","{{ player_id }}","{{WEB_URL}}{{MEDIA_URL}}swf/player.swf");
</script>
\ No newline at end of file
--- a/web/eulalie/templates/eulalie/workspace.html Mon Jun 14 15:23:07 2010 +0200
+++ b/web/eulalie/templates/eulalie/workspace.html Tue Jun 15 00:25:30 2010 +0200
@@ -81,7 +81,7 @@
<td><a href="{% url ldt.ldt_utils.views.index content.iri_id %}" class="ldt_link">{% trans "open ldt" %}</a></td>
<td><a href="{% url ldt.ldt_utils.views.create_project content.iri_id %}" class="ldt_link_create">{% trans "create project" %}</a></td>
{% url ldt.ldt_utils.views.project_json_externalid content.external_id as json_url_externalid %}
- <td><a href="{{json_url_externalid}}" class="ldt_link_embed" id="player_project_{{content.iri_id}}">{% trans "link json by externalid" %}</a>
+ <td><a href="{{WEB_URL}}{{json_url_externalid}}" class="ldt_link_embed" id="player_project_{{content.iri_id}}">{% trans "link json by externalid" %}</a>
</td>
</tr>
{% endfor %}
@@ -97,7 +97,7 @@
<td><a href="{% url ldt.ldt_utils.views.indexProject project.ldt_id %}" class="ldt_link">{% trans "open ldt" %}</a></td>
<td><a href="{% url ldt.ldt_utils.views.copy_project project.ldt_id %}" class="ldt_link_create">{% trans "copy project" %}</a></td>
{% url ldt.ldt_utils.views.project_json_id project.ldt_id as json_url_id %}
- <td><a href="{{json_url_id}}" class="ldt_link_embed" id="player_project_{{project.ldt_id}}">{% trans "link json by id" %}</a>
+ <td><a href="{{WEB_URL}}{{json_url_id}}" class="ldt_link_embed" id="player_project_{{project.ldt_id}}">{% trans "link json by id" %}</a>
</tr>
{% endfor %}
</table>
--- a/web/ldt/ldt_utils/fileimport.py Mon Jun 14 15:23:07 2010 +0200
+++ b/web/ldt/ldt_utils/fileimport.py Tue Jun 15 00:25:30 2010 +0200
@@ -50,21 +50,18 @@
if 'http' in self.src:
url = urllib.urlopen(self.src)
doc = xml.dom.minidom.parse(url)
- doc = Ft.Xml.Domlette.ConvertDocument(doc)
- con = xml.xpath.Context.Context(doc, 1, 1, None)
- #open .iri and get the title
- res = xml.xpath.Evaluate("/iri/head/meta[@name='title']/@content", context=con)
- self.title = res[0].value
-
#for import a zip, get title and copy file .iri in the media directory
else:
path = os.path.join(self.basepath, self.src)
doc = xml.dom.minidom.parse(path)
-
- con = xml.xpath.Context.Context(doc, 1, 1, None)
-
- res = xml.xpath.Evaluate("/iri/head/meta[@name='title']/@content", context=con)
- self.title = res[0].value
+
+
+ doc = Ft.Xml.Domlette.ConvertDocument(doc)
+ con = xml.xpath.Context.Context(doc, 1, 1, None)
+
+ res = xml.xpath.Evaluate("/iri/head/meta[@name='title']/@content", context=con)
+ self.title = res[0].value
+
res = xml.xpath.Evaluate("/iri/body/ensembles",context=con)
ensemblesnode = res[0]
@@ -105,7 +102,7 @@
res = xml.xpath.Evaluate("/iri/body/medias/media[@id='video']/video", context=con)
if self.flatten:
- src_video = res[0].getAttribute('src')
+ src_video = res[0].getAttributeNS(None,'src')
self.videourl = os.path.basename(src_video)
res[0].setAttributeNS(None,'src', self.videourl)
self.duration = res[0].getAttributeNS(None, u'dur')
--- a/web/ldt/ldt_utils/models.py Mon Jun 14 15:23:07 2010 +0200
+++ b/web/ldt/ldt_utils/models.py Tue Jun 15 00:25:30 2010 +0200
@@ -2,8 +2,7 @@
from django.conf import settings
from ldt.core.models import Document, Owner
from django.utils.translation import ugettext_lazy as _
-from utils import create_ldt, copy_ldt, create_empty_iri
-import os
+from utils import create_ldt, copy_ldt, create_empty_iri, update_iri
import os.path
import uuid
import xml
@@ -58,6 +57,9 @@
os.makedirs(dir)
file = open(iri_file_path,"w")
create_empty_iri(file, self, "IRI")
+ else:
+ update_iri(iri_file_path, self, "IRI")
+
except Exception, e:
if os.path.exists(iri_file_path):
os.remove(iri_file_path)
--- a/web/ldt/ldt_utils/utils.py Mon Jun 14 15:23:07 2010 +0200
+++ b/web/ldt/ldt_utils/utils.py Tue Jun 15 00:25:30 2010 +0200
@@ -10,9 +10,8 @@
import xml.dom.minidom
import xml.dom.ext
import xml.xpath
-import os
-import os.path
import datetime
+import Ft
class LdtSearch(object):
@@ -277,6 +276,7 @@
writer.simpleElement(u'meta', attributes={u'name':u'id', 'content':unicode(content.iri_id)})
writer.simpleElement(u'meta', attributes={u'name':u'title', 'content':unicode(content.title)})
+ writer.simpleElement(u'meta', attributes={u'name':u'abstract', 'content':unicode(content.description)})
writer.simpleElement(u'meta', attributes={u'name':u'author', 'content':unicode(username)})
writer.simpleElement(u'meta', attributes={u'name':u'contributor', 'content':unicode(username)})
writer.simpleElement(u'meta', attributes={u'name':u'date', 'content':unicode(datetime.date.today().isoformat())})
@@ -294,7 +294,7 @@
writer.startElement(u"medias")
writer.startElement(u"media", attributes={u'id':u'video'})
- writer.simpleElement(u'video', attributes={u'src':unicode(content.src),u'id':unicode(uuid.uuid1()),u'dur':unicode(content.duration),u'begin':u'0'})
+ writer.simpleElement(u'video', attributes={u'src':unicode(content.src),u'id':unicode(content.iri_id),u'dur':unicode(content.duration),u'begin':u'0'})
writer.endElement(u"media")
writer.startElement(u"media", attributes={u'id':u'tool'})
@@ -312,3 +312,43 @@
writer.endElement(u"iri")
writer.endDocument()
+def update_iri(filepath, content, username):
+
+ # open xml
+ doc = xml.dom.minidom.parse(filepath)
+ doc = Ft.Xml.Domlette.ConvertDocument(doc)
+
+ con = xml.xpath.Context.Context(doc, 1, 1, None)
+ res = xml.xpath.Evaluate("/iri/heqd/meta", context=con)
+ # update meta
+
+ for meta_node in res:
+ meta_name = meta_node.getAttributeNS(None,"name")
+ content_attr = None
+ if meta_name == u'id':
+ content_attr = unicode(content.iri_id)
+ elif meta_name == u'title':
+ content_attr = unicode(content.title)
+ elif meta_name == u'abstract':
+ content_attr = unicode(content.description)
+ elif meta_name == u'contributor':
+ content_attr = unicode(username)
+ elif meta_name == u"date":
+ content_attr = unicode(datetime.date.today().isoformat())
+ if content_attr is not None:
+ meta_node.setAttributeNS(None, u"content", content_attr)
+
+ res = xml.xpath.Evaluate("/iri/body/medias/media[@id='video']/video", context=con)
+
+ if len(res) > 0:
+ video_node = res[0]
+ video_node.setAttributeNS(None, u'src', unicode(content.src))
+ video_node.setAttributeNS(None, u'dur', unicode(content.duration))
+ video_node.setAttributeNS(None, u'id', unicode(content.iri_id))
+ # update video
+
+ f = open(filepath, "w")
+ try:
+ xml.dom.ext.Print(doc, stream=f)
+ finally:
+ f.close()