correct serialization
authorymh <ymh.work@gmail.com>
Thu, 10 Jun 2010 20:49:13 +0200
changeset 26 d5b6908e4da5
parent 25 9508e39672bb
child 27 f81da251d0aa
correct serialization
web/eulalie/__init__.py
web/ldt/ldt_utils/projectserializer.py
web/ldt/ldt_utils/views.py
--- a/web/eulalie/__init__.py	Thu Jun 10 19:58:55 2010 +0200
+++ b/web/eulalie/__init__.py	Thu Jun 10 20:49:13 2010 +0200
@@ -1,4 +1,4 @@
-VERSION = (0,4)
+VERSION = (0,5)
 
 VERSION_STR = unicode(".".join(map(lambda i:"%02d" % (i,), VERSION)))
 
--- a/web/ldt/ldt_utils/projectserializer.py	Thu Jun 10 19:58:55 2010 +0200
+++ b/web/ldt/ldt_utils/projectserializer.py	Thu Jun 10 20:49:13 2010 +0200
@@ -35,7 +35,7 @@
         new_list = {
             "id" : ensemble_id,
             "items" : list_items,
-            "metas" : {
+            "meta" : {
                 "dc:creator":ensemble_author,
                 "dc:created": ensemble_created,
                 "dc:contributor":"undefined",
@@ -148,7 +148,7 @@
                     if tag_id not in self.tags:
                         new_tag = {
                             "id":tag_id,
-                            "metas" : {
+                            "meta" : {
                                 "dc:creator":"IRI",
                                 "dc:created": tag_date,
                                 "dc:contributor":"IRI",
@@ -175,7 +175,7 @@
                             "href": element_audio_href
                         },
                     },
-                    "metas": {
+                    "meta": {
                         "id-ref": decoupage_id,
                         "dc:creator": decoupage_creator,
                         "dc:contributor": decoupage_contributor,
@@ -250,16 +250,24 @@
         new_media = {
              "http://advene.liris.cnrs.fr/ns/frame_of_reference/ms" : "o=0",
              "id" : content.iri_id,
-             "url" : content.videopath.rstrip('/') + "/" + content.src,
-             "dc:creator" : author,
-             "dc:created" : content.creation_date.isoformat(),
-             "dc:contributor" : contributor,
-             "dc:modified" : content.update_date.isoformat(),
-             "dc:creator.contents" : content_author,
-             "dc:created.contents" : content_date,
-             "dc:title" : content.title,
-             "dc:description" : content.description,
-             "dc:duration" : content.get_duration(),
+             "href" : content.videopath.rstrip('/') + "/" + content.src,
+             "unit" : "ms",
+             "origin" : "0",
+             "meta": {
+                 "dc:creator" : author,
+                 "dc:created" : content.creation_date.isoformat(),
+                 "dc:contributor" : contributor,
+                 "dc:modified" : content.update_date.isoformat(),
+                 "dc:creator.contents" : content_author,
+                 "dc:created.contents" : content_date,
+                 "dc:title" : content.title,
+                 "dc:description" : content.description,
+                 "dc:duration" : content.get_duration(),
+                 "item": {
+                     "name" : "streamer",
+                     "value": content.videopath.rstrip('/') + "/"
+                 },
+             }
         }
         
         self.medias.append(new_media)
@@ -281,7 +289,7 @@
         if len(self.medias) > 0:
             project_main_media = self.medias[0]["id"]
         
-        res['metas'] = {
+        res['meta'] = {
              'id': self.project.ldt_id,
              'dc:created':self.project.creation_date.isoformat(),
              'dc:modified':self.project.modification_date.isoformat(),
--- a/web/ldt/ldt_utils/views.py	Thu Jun 10 19:58:55 2010 +0200
+++ b/web/ldt/ldt_utils/views.py	Thu Jun 10 20:49:13 2010 +0200
@@ -203,10 +203,11 @@
 
 def project_json(request, project):
 
-    mimetype = request.REQUEST.get("mimetype").encode("utf-8")
+    mimetype = request.REQUEST.get("mimetype")
     if mimetype is None:
         mimetype = "application/json; charset=utf-8"
-
+    else:
+        mimetype.encode("utf-8") 
     resp = HttpResponse(mimetype=mimetype)
     resp['Cache-Control']='no-cache, must-revalidate'
     resp['Pragma']='no-cache'