Update and data api doc
authorveltr
Thu, 14 Jun 2012 17:28:20 +0200
changeset 1 ed19b689de87
parent 0 222f9654ed39
child 2 3cc57cb48aea
Update and data api doc
metadataplayer/docs/data-api.md
metadataplayer/metadataplayer/Annotation.js
metadataplayer/metadataplayer/AnnotationsList.js
metadataplayer/metadataplayer/CreateAnnotation.js
metadataplayer/metadataplayer/LdtPlayer-core.js
metadataplayer/metadataplayer/MediaList.js
metadataplayer/metadataplayer/Mediafragment.js
metadataplayer/metadataplayer/Polemic.js
metadataplayer/metadataplayer/Segments.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/metadataplayer/docs/data-api.md	Thu Jun 14 17:28:20 2012 +0200
@@ -0,0 +1,304 @@
+# API d’accès aux métadonnées #
+
+ATTENTION !
+Cette documentation se réfère à la v.3 du Metadataplayer, actuellement disponible dans la branche **new-model** du repository
+http://www.iri.centrepompidou.fr/dev/hg/metadataplayer
+
+## Élément de base ##
+
+    IriSP.Model.Element
+
+### Rôle ###
+
+Classe de base dont héritent les différents types d’objets utilisés dans le Metadataplayer: annotations, types d’annotations, médias, etc.
+
+### Instanciation ###
+
+**Element** fonctionne comme une classe abstraite est n’est jamais instancié directement.
+
+Néanmoins, tous les objets en héritant seront instanciés de la manière suivante :
+
+    var myElement = new IriSP.Model.Element(id, source);
+
+- **id** est l’identifiant unique de l’élément. S’il est à *false*, un identifiant unique sera généré.
+- **source** identifie la source de données dont provient l’élément (cf. Source de Données, *IriSP.Model.Source*, plus bas).
+
+### Propriétés ###
+
+#### type ####
+
+Type d’élément, surchargé par les classes qui héritent de l’élément de base:
+
+- **element** pour IriSP.Model.Element
+- **media** pour IriSP.Model.Media
+- **annotationType** pour IriSP.Model.AnnotationType
+- **tag** pour IriSP.Model.Tag
+- **annotation** pour IriSP.Model.Annotation
+- **mashup** pour IriSP.Model.Mashup
+- **mashedAnnotation** pour IriSP.Model.MashedAnnotation
+
+#### id ####
+
+Identifiant unique de l’élément
+
+#### title ####
+
+Titre de l’élément, par défaut une chaîne vide ("")
+
+#### description ####
+
+Description de l’élément, par défaut une chaîne vide ("")
+
+## Media ##
+
+    IriSP.Model.Media
+
+### Rôle ###
+
+Représente un média (vidéo ou audio).
+
+Hérite de l’Élément de base
+
+### Propriétés ###
+
+#### video ####
+
+Il s’agit de l’URL de la vidéo à charger
+
+#### duration ####
+
+Il s’agit de la durée du média (telle que renseignée dans les métadonnées -- peut ne pas être égale à la durée telle que lue dans la fenêtre vidéo).
+
+Il s’agit d’un objet durée (cf. *IriSP.Model.Time* plus bas)
+
+### Méthodes ###
+
+#### getDuration ####
+
+Permet de spécifier la durée du média, en millisecondes
+
+#### getAnnotations ####
+
+Retourne la liste des annotations associées au média
+
+#### getAnnotationsByTypeTitle ####
+
+Retourne la liste des annotations associées au média et dont le type d’annotation (ou découpage, ou ligne, c.f. Type d’Annotation plus bas) correspond à l’argument de la fonction
+
+## Type d’Annotation ##
+
+    IriSP.Model.AnnotationType
+
+### Rôle ###
+
+Représente un type d’annotation, correspondant également à ce qui peut être nommé découpage ou ligne dans *Lignes de Temps*
+
+Hérite de l’Élément de base.
+
+### Méthodes ###
+
+#### getAnnotations ####
+
+Retourne la liste des annotations associées au type d’annotation
+
+## Annotation ##
+
+    IriSP.Model.Annotation
+
+### Rôle ###
+
+Représente une annotation, correspondant à un segment temporel (dont la durée peut être nulle) d’un média
+
+Hérite de l’Élément de base.
+
+### Propriétés ###
+
+#### begin ####
+
+Timecode de fin de l’annotation. Est un objet de type durée (cf. plus bas)
+
+#### begin ####
+
+Timecode de début de l’annotation. Est un objet de type durée (cf. plus bas)
+
+### Méthodes ###
+
+#### getMedia ####
+
+Retourne l’objet **Média** (*IriSP.Model.Media*) auquel se réfère l’annotation
+
+#### getAnnotationType ####
+
+Retourne l’objet **Type d’Annotation** (*IriSP.Model.AnnotationType*) auquel se réfère l’annotation
+
+#### getTags ####
+
+Retourne la liste (cf. Liste d’éléments *IriSP.Model.List*) des tags associés à l’annotation.
+
+#### getTagTexts ####
+
+## Mashup ##
+
+    IriSP.Model.Mashup
+
+### Rôle ###
+
+Il s’agit d’un bout à bout, composé d’une liste de segments (définis par des annotations de durée non nulle) accolés les uns après les autres.
+
+### Méthodes ###
+
+**À compléter**
+
+## Liste d’éléments ##
+
+    IriSP.Model.List
+
+### Rôle ###
+
+Etend les fonctionnalités des tableaux javascript (*Array*) pour lister des éléments (cf. types d’éléments ci-dessus).
+
+### Instanciation ###
+
+    var myList = new IriSP.Model.List(directory);
+
+- **directory** est le répertoire de données auxquelles la liste permet d’accéder (cf. plus bas)
+
+### Méthodes ###
+
+#### Méthodes de parcours de liste ####
+
+Ces méthodes sont fournies grâce à la bibliothèque extérieure *underscore.js* et sont documentées sur http://documentcloud.github.com/underscore/
+
+Il s’agit de:
+
+- **map**: Renvoie un tableau (*Array*) dont les éléments correspondent aux éléments de la liste, via une fonction passée en argument de map
+- **forEach**: Itère une fonction sur la liste.
+- **filter**: Ne renvoie que les éléments de la liste dont la valeur correspond au résultat d’une fonction.
+- **sortBy**: Fonction de tri, par ordre croissant de la valeur retournée par la fonction passée en argument.
+
+#### searchByTitle, searchByDescription, searchByTextFields ####
+
+Méthodes retournant une nouvelle liste d’éléments, contenant les éléments de la liste dont respectivement le titre, la description ou les deux correspondent à l’argument de la méthode.
+
+    myList.searchByTitle("texte"); // => un *IriSP.Model.List* contenant les éléments de myList dont le titre contient "texte"
+
+## Durée ##
+
+    IriSP.Model.Time
+
+### Rôle ###
+
+Facilite la gestion des durées en millisecondes utilisées dans le Metadataplayer
+
+### Instanciation ###
+
+    var myTime = new IriSP.Model.Time(ms);
+
+- **ms** est une durée en millisecondes
+
+### Méthodes ###
+
+#### getSeconds ####
+
+Renvoie la durée convertie en secondes
+
+#### toString ####
+
+Renvoie la durée au format (hh:)mm:ss
+
+#### setSeconds ####
+
+Permet d’affecter une durée en secondes
+
+    myTime.setSeconds(12); // 12000 millisecondes
+
+## Source de données ##
+
+    IriSP.Model.Source
+
+et
+    IriSP.Model.RemoteSource
+
+### Rôle ###
+
+Gère une source de données : fichier externe JSON, XML, etc. pour *IriSP.Model.RemoteSource*, projet créé à la volée pour *IriSP.Model.Source*.
+
+*IriSP.Model.RemoteSource* hérite de *IriSP.Model.Source* et ne diffère que par son implémentation de la méthode *get*.
+
+Sur la plateforme *Lignes de Temps*, il existe plusieurs API qui sont utilisées comme sources :
+
+- L’API projet, qui renvoie un fichier JSON contenant un projet LDT complet.
+- L’API segment, qui renvoie toutes les annotations d’un média situées entre deux timecodes fournis en argument.
+- L’API de publication d’annotation, qui demande l’envoi (par la méthode HTTP PUT) d’une liste d’annotation et renvoie celle-ci en retour, avec les identifiants des annotations en base de données.
+
+### Instanciation ###
+
+    var config = { directory: myDirectory };
+    var mySource = new IriSP.Model.Source(config);
+
+- **config** est un objet contenant les options de configuration:
+    - Il doit nécessairement contenir une propriété **directory**, désignant le répertoire de données (cf. plus bas).
+    - La propriété **serializer** doit désigner le *Sérialiseur* utilisé pour désérialiser les données importées ou sérialiser l’export.
+    - un *IriSP.Model.RemoteSource* doit également être appelé avec une propriété **url**, désignant l’URL de la source.
+
+Une Source ne doit pas être instanciée directement, ce rôle est donné aux répertoires de données, ce qui permet notamment d’éviter des accès multiples à une même URL.
+
+### Propriétés ###
+
+#### currentMedia ####
+
+*TODO: transférer dans un objet "Project"*
+
+Donne accès au média en cours du projet. Peut désigner un vrai média ou un mashup.
+
+### Méthodes ###
+
+#### get ####
+
+Permet de récupérer ou de rafraîchir, via Ajax, les données de la source. Pour un *IriSP.Model.Source* de base, n’a aucun effet.
+
+#### onLoad ####
+
+Permet d’exécuter une fonction, passée en argument, au chargement de la source.
+
+#### serialize, deSerialize ####
+
+Transforme les données de la source en données sérialisées, au format du sérialiseur associées à la source, et inversement.
+
+#### getAnnotations, getAnnotationTypes, getMedias, getTags, getMashups ####
+
+Retourne les listes respectives d’annotations, types d’annotations, médias, tags et mashups de la source.
+
+#### getAnnotationsByTypeTitle ####
+
+Retourne la liste des annotations dont le type d’annotation correspond à l’argument de la fonction.
+
+## Répertoire de données ##
+
+    IriSP.Model.Directory
+
+### Rôle ###
+
+Gère l’instanciation des sources de données et la mise en cache de ces sources lorsque plusieurs appels à la même URLs sont faits.
+
+Permet également aux objets de plusieurs sources d’interagir entre eux.
+
+### Instanciation ###
+
+    var myDirectory = new IriSP.Model.Directory
+
+### Méthodes ###
+
+#### newLocalSource ####
+
+Crée une nouvelle source non attachée à une URL. S’il faut exporter des données, un sérialiseur doit être passé en paramètres.
+
+    var myConfig = { serializer: IriSP.serializers.ldt };
+    var myLocalSource = myDirectory.newLocalSource(myConfig);
+
+#### remoteSource ####
+
+Crée ou récupère (si celle-ci existe déjà) une source attachée à une URL. Le sérialiseur est obligatoire.
+
+    var myConfig = { url: "source-data.json", serializer: IriSP.serializers.ldt };
+    var myLocalSource = myDirectory.remoteSource(myConfig);
--- a/metadataplayer/metadataplayer/Annotation.js	Thu Jun 07 23:14:10 2012 +0200
+++ b/metadataplayer/metadataplayer/Annotation.js	Thu Jun 14 17:28:20 2012 +0200
@@ -77,7 +77,7 @@
     this.lastAnnotation = _annotation.id;
     var _url = (typeof _annotation.url !== "undefined" 
             ? _annotation.url
-            : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.namespacedId.name));
+            : (document.location.href.replace(/#.*$/,'') + '#id='  + _annotation.id));
     var _text = this.l10n.watching + _annotation.title + (this.site_name ? this.l10n.on_site + this.site_name : '');
     var _tags = _annotation.getTagTexts();
     if (_tags.length) {
--- a/metadataplayer/metadataplayer/AnnotationsList.js	Thu Jun 07 23:14:10 2012 +0200
+++ b/metadataplayer/metadataplayer/AnnotationsList.js	Thu Jun 14 17:28:20 2012 +0200
@@ -84,7 +84,7 @@
     this.lastAjaxQuery = _currentTime;
     _currentTime = Math.floor(1000 * _currentTime);
     var _url = Mustache.to_html(this.ajax_url, {
-        media : this.source.currentMedia.namespacedId.name,
+        media : this.source.currentMedia.id,
         begin : Math.max(0, _currentTime - this.ajax_granularity),
         end : Math.min(_duration.milliseconds, _currentTime + this.ajax_granularity)
     });
@@ -99,11 +99,11 @@
         _currentTime = 0;
     }
     var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime * 1000);
-    if (typeof _currentAnnotation !== "undefined" && _currentAnnotation.namespacedId.name !== this.lastMashupAnnotation) {
-        this.lastMashupAnnotation = _currentAnnotation.namespacedId.name;
+    if (typeof _currentAnnotation !== "undefined" && _currentAnnotation.id !== this.lastMashupAnnotation) {
+        this.lastMashupAnnotation = _currentAnnotation.id;
         var _currentMedia = _currentAnnotation.getMedia(),
             _url = Mustache.to_html(this.ajax_url, {
-                media : _currentMedia.namespacedId.name,
+                media : _currentMedia.id,
                 begin : Math.max(0, _currentAnnotation.annotation.begin.milliseconds - this.ajax_granularity),
                 end : Math.min(_currentMedia.duration.milliseconds, _currentAnnotation.annotation.end.milliseconds + this.ajax_granularity)
             });
@@ -129,9 +129,9 @@
         var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime * 1000);
         if (typeof _currentAnnotation !== "undefined") {
             _currentTime = _currentTime - _currentAnnotation.begin.getSeconds() + _currentAnnotation.annotation.begin.getSeconds();
-            var _mediaId = _currentAnnotation.getMedia().namespacedId.name;
+            var _mediaId = _currentAnnotation.getMedia().id;
             _list = _list.filter(function(_annotation) {
-                return _annotation.getMedia().namespacedId.name === _mediaId;
+                return _annotation.getMedia().id === _mediaId;
             });
         }
     }
@@ -169,15 +169,15 @@
                                 {
                                     project : _annotation.project,
                                     media : _annotation.media.id.replace(/^.*:/,''),
-                                    annotation : _annotation.namespacedId.name,
+                                    annotation : _annotation.id,
                                     annotationType : _annotation.annotationType.id.replace(/^.*:/,'')
                                 }
                             )
-                            : '#id=' + _annotation.namespacedId.name
+                            : '#id=' + _annotation.id
                             )
                     );
                     var _res = {
-                        id : _annotation.namespacedId.name,
+                        id : _annotation.id,
                         title : _annotation.title.replace(_annotation.description,''),
                         description : _annotation.description,
                         begin : _annotation.begin.toString(),
--- a/metadataplayer/metadataplayer/CreateAnnotation.js	Thu Jun 07 23:14:10 2012 +0200
+++ b/metadataplayer/metadataplayer/CreateAnnotation.js	Thu Jun 14 17:28:20 2012 +0200
@@ -216,9 +216,14 @@
     var _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager);
         _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}),
         _annotation = new IriSP.Model.Annotation(false, _export),
-        _annotationType = new IriSP.Model.AnnotationType(false, _export),
+        _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type),
+        _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)),
         _url = Mustache.to_html(this.api_endpoint_template, {id: this.source.projectId});
 
+    if (!_annotationTypes.length) {
+        _annotationType.dont_send_id = true;
+    }
+    
     _annotationType.title = this.annotation_type;
     _annotation.setBegin(this.begin);
     _annotation.setEnd(this.end);
@@ -254,6 +259,7 @@
         },
         error: function(_xhr, _error, _thrown) {
             IriSP.log("Error when sending annotation", _thrown);
+            _export.getAnnotations().removeElement(_annotation, true);
             _this.showScreen('Error');
             window.setTimeout(function(){
                 _this.showScreen("Main")
--- a/metadataplayer/metadataplayer/LdtPlayer-core.js	Thu Jun 07 23:14:10 2012 +0200
+++ b/metadataplayer/metadataplayer/LdtPlayer-core.js	Thu Jun 14 17:28:20 2012 +0200
@@ -611,8 +611,26 @@
     _SOURCE_STATUS_WAITING : 1,
     _SOURCE_STATUS_READY : 2,
     _ID_AUTO_INCREMENT : 0,
+    _ID_BASE : (function(_d) {
+        function pad(n){return n<10 ? '0'+n : n}
+        function fillrand(n) {
+            var _res = ''
+            for (var i=0; i<n; i++) {
+                _res += Math.floor(16*Math.random()).toString(16);
+            }
+            return _res;
+        }
+        return _d.getUTCFullYear() + '-'  
+            + pad(_d.getUTCMonth()+1) + '-'  
+            + pad(_d.getUTCDate()) + '-'
+            + fillrand(16);
+    })(new Date()),
     getUID : function() {
-        return "autoid-" + (++this._ID_AUTO_INCREMENT);
+        var _n = (++this._ID_AUTO_INCREMENT).toString();
+        while (_n.length < 4) {
+            _n = '0' + _n
+        }
+        return "autoid-" + this._ID_BASE + '-' + _n;
     },
     regexpFromTextOrArray : function(_textOrArray) {
         function escapeText(_text) {
@@ -653,7 +671,7 @@
         _res.setTime(Number(time));
         return _res;
     },
-    dateToIso : function(d) {  
+    dateToIso : function(d) {
         function pad(n){return n<10 ? '0'+n : n}  
         return d.getUTCFullYear()+'-'  
             + pad(d.getUTCMonth()+1)+'-'  
@@ -924,14 +942,11 @@
 
 IriSP.Model.Reference = function(_source, _idRef) {
     this.source = _source;
+    this.id = _idRef;
     if (typeof _idRef === "object") {
         this.isList = true;
-        this.id = IriSP._(_idRef).map(function(_id) {
-            return _source.getNamespaced(_id).fullname;
-        });
     } else {
         this.isList = false;
-        this.id = _source.getNamespaced(_idRef).fullname;
     }
     this.refresh();
 }
@@ -972,8 +987,7 @@
         _id = IriSP.Model.getUID();
     }
     this.source = _source;
-    this.namespacedId = _source.getNamespaced(_id)
-    this.id = this.namespacedId.fullname;
+    this.id = _id;
     this.title = "";
     this.description = "";
     this.source.directory.addElement(this);
@@ -1113,7 +1127,7 @@
 /* */
 
 IriSP.Model.MashedAnnotation = function(_mashup, _annotation) {
-    IriSP.Model.Element.call(this, _mashup.namespacedId.name + "_" + _annotation.namespacedId.name, _annotation.source);
+    IriSP.Model.Element.call(this, _mashup.id + "_" + _annotation.id, _annotation.source);
     this.elementType = 'mashedAnnotation';
     this.annotation = _annotation;
     this.begin = new IriSP.Model.Time(_mashup.duration);
@@ -1217,54 +1231,10 @@
         })
         this.callbackQueue = [];
         this.contents = {};
-        if (typeof this.namespace === "undefined") {
-            this.namespace = "metadataplayer";
-        } else {
-            if (typeof this.namespaceUrl === "undefined" && typeof this.url !== "undefined") {
-                var _matches = this.url.match(/(^[^?&]+|[^?&][a-zA-Z0-9_%=?]+)/g),
-                    _url = _matches[0];
-                if (_matches.length > 1) {
-                    _matches = IriSP._(_matches.slice(1)).reject(function(_txt) {
-                        return /\?$/.test(_txt);
-                    });
-                }
-                if (_matches.length > 0) {
-                    _url += '?' + _matches.join('&');
-                }
-                this.namespaceUrl = _url;
-            }
-        }
-        if (typeof this.namespaceUrl === "undefined") {
-            this.namespaceUrl = "http://ldt.iri.centrepompidou.fr/";
-        }
-        this.directory.addNamespace(this.namespace, this.namespaceUrl);
         this.get();
     }
 }
 
-IriSP.Model.Source.prototype.getNamespaced = function(_id) {
-    var _tab = _id.split(':');
-    if (_tab.length > 1) {
-        return {
-            namespace : _tab[0],
-            name : _tab[1],
-            fullname : _id
-        }
-    } else {
-        return {
-            namespace : this.namespace,
-            name : _id,
-            fullname : this.namespace + ':' + _id
-        }
-    }
-}
-    
-IriSP.Model.Source.prototype.unNamespace = function(_id) {
-    if (typeof _id !== "undefined") {
-        return _id.replace(this.namespace + ':', '');
-    }
-}
-
 IriSP.Model.Source.prototype.addList = function(_listId, _contents) {
     if (typeof this.contents[_listId] === "undefined") {
         this.contents[_listId] = new IriSP.Model.List(this.directory);
@@ -1291,7 +1261,7 @@
 }
 
 IriSP.Model.Source.prototype.getElement = function(_elId) {
-    return this.directory.getElement(this.getNamespaced(_elId).fullname);
+    return this.directory.getElement(_elId);
 }
 
 IriSP.Model.Source.prototype.setCurrentMediaId = function(_idRef) {
@@ -1306,21 +1276,6 @@
     }
 }
 
-IriSP.Model.Source.prototype.listNamespaces = function(_excludeSelf) {
-    var _this = this,
-        _nsls = [],
-        _excludeSelf = (typeof _excludeSelf !== "undefined" && _excludeSelf);
-    this.forEach(function(_list) {
-        IriSP._(_list).forEach(function(_el) {
-            var _ns = _el.id.replace(/:.*$/,'');
-            if (IriSP._(_nsls).indexOf(_ns) === -1 && (!_excludeSelf || _ns !== _this.namespace)) {
-                _nsls.push(_ns);
-            }
-        })
-    });
-    return _nsls;
-}
-
 IriSP.Model.Source.prototype.get = function() {
     this.status = IriSP.Model._SOURCE_STATUS_WAITING;
     this.handleCallbacks();
@@ -1427,11 +1382,6 @@
 IriSP.Model.Directory = function() {
     this.remoteSources = {};
     this.elements = {};
-    this.namespaces = {};
-}
-
-IriSP.Model.Directory.prototype.addNamespace = function(_namespace, _url) {
-    this.namespaces[_namespace] = _url;
 }
 
 IriSP.Model.Directory.prototype.remoteSource = function(_properties) {
@@ -1584,7 +1534,15 @@
         }
     }
     
-    this.l10n = (typeof this.messages[IriSP.language] !== "undefined" ? this.messages[IriSP.language] : this.messages["en"]);
+    this.l10n = (
+        typeof this.messages[IriSP.language] !== "undefined"
+        ? this.messages[IriSP.language]
+        : (
+            IriSP.language.length > 2 && typeof this.messages[IriSP.language.substr(0,2)] !== "undefined"
+            ? this.messages[IriSP.language.substr(0,2)]
+            : this.messages["en"]
+        )
+    );
     
 };
 
@@ -2099,7 +2057,7 @@
             },
             serializer : function(_data, _source) {
                 return {
-                    id : _source.unNamespace(_data.id),
+                    id : _data.id,
                     url : _data.video,
                     meta : {
                         "dc:title" : _data.title,
@@ -2119,7 +2077,7 @@
             },
             serializer : function(_data, _source) {
                 return {
-                    id : _source.unNamespace(_data.id),
+                    id : _data.id,
                     meta : {
                         "dc:title" : _data.title
                     }
@@ -2136,7 +2094,7 @@
             },
             serializer : function(_data, _source) {
                 return {
-                    id : _source.unNamespace(_data.id),
+                    id : _data.id,
                     "dc:title" : _data.title,
                     "dc:description" : _data.description
                 }
@@ -2176,7 +2134,7 @@
             },
             serializer : function(_data, _source) {
                 return {
-                    id : _source.unNamespace(_data.id),
+                    id : _data.id,
                     begin : _data.begin.milliseconds,
                     end : _data.end.milliseconds,
                     content : {
@@ -2184,16 +2142,16 @@
                         description : _data.description,
                         audio : _data.audio
                     },
-                    media : _source.unNamespace(_data.media.id),
+                    media : _data.media.id,
                     meta : {
-                        "id-ref" : _source.unNamespace(_data.annotationType.id),
+                        "id-ref" : _data.annotationType.id,
                         "dc:created" : IriSP.Model.dateToIso(_data.created),
                         "dc:creator" : _data.creator,
                         project : _source.projectId
                     },
                     tags : IriSP._(_data.tag.id).map(function(_id) {
                        return {
-                           "id-ref" : _source.unNamespace(_id)
+                           "id-ref" : _id
                        } 
                     })
                 }
@@ -2215,7 +2173,7 @@
                     "dc:title": _data.title,
                     "dc:description": _data.description,
                     segments: _data.segments.map(function(_annotation) {
-                        return _source.unNamespace(_id);
+                        return _id;
                     })
                 }
             }
@@ -2241,9 +2199,9 @@
             return;
         }
         IriSP._(this.types).forEach(function(_type, _typename) {
-            var _listdata = _data[_type.serialized_name];
+            var _listdata = _data[_type.serialized_name],
+                _list = new IriSP.Model.List(_source.directory);
             if (typeof _listdata !== "undefined" && _listdata !== null) {
-                var _list = new IriSP.Model.List(_source.directory);
                 if (_listdata.hasOwnProperty("length")) {
                     var _l = _listdata.length;
                     for (var _i = 0; _i < _l; _i++) {
@@ -2252,8 +2210,8 @@
                 } else {
                     _list.push(_type.deserializer(_listdata, _source));
                 }
-                _source.addList(_typename, _list);
             }
+            _source.addList(_typename, _list);
         });
         
         if (typeof _data.meta !== "undefined") {
@@ -2278,17 +2236,19 @@
         annotation : {
             serialized_name : "annotations",
             serializer : function(_data, _source) {
+                var _annType = _data.getAnnotationType();
                 return {
                     begin: _data.begin.milliseconds,
                     end: _data.end.milliseconds,
                     content: {
-                        data: _data.description
+                        data: _data.description,
+                        audio: _data.audio
                     },
                     tags: _data.getTagTexts(),
-                    media: _source.unNamespace(_data.getMedia().id),
+                    media: _data.getMedia().id,
                     title: _data.title,
-                    type_title: _data.getAnnotationType().title,
-                    type: _source.unNamespace(_data.getAnnotationType().id)
+                    type_title: _annType.title,
+                    type: ( typeof _annType.dont_send_id !== "undefined" && _annType.dont_send_id ? "" : _annType.id )
                 }
             }
         }
@@ -2348,6 +2308,9 @@
             _ann.setBegin(_anndata.begin);
             _ann.setEnd(_anndata.end);
             _ann.creator = _data.meta.creator;
+            if (typeof _anndata.content.audio !== "undefined" && _anndata.content.audio.href) {
+                _ann.audio = _anndata.content.audio;
+            }
             _source.getAnnotations().push(_ann);
         }
     }
--- a/metadataplayer/metadataplayer/MediaList.js	Thu Jun 07 23:14:10 2012 +0200
+++ b/metadataplayer/metadataplayer/MediaList.js	Thu Jun 14 17:28:20 2012 +0200
@@ -66,7 +66,7 @@
         this.$.find('.Ldt-MediaList-Now-Description').html(_media.description);
         var _url = _media.url || Mustache.to_html(
                 this.media_url_template, {
-                    media: _media.namespacedId.name
+                    media: _media.id
                 });
         this.$.find('.Ldt-MediaList-NowContainer a').attr("href", _url);
     } else {
@@ -84,7 +84,7 @@
                 thumbnail: _media.thumbnail || _this.default_thumbnail,
                 url: _media.url || Mustache.to_html(
                     _this.media_url_template, {
-                        media: _media.namespacedId.name
+                        media: _media.id
                     }),
                 title: _media.title,
                 description: _media.description
--- a/metadataplayer/metadataplayer/Mediafragment.js	Thu Jun 07 23:14:10 2012 +0200
+++ b/metadataplayer/metadataplayer/Mediafragment.js	Thu Jun 14 17:28:20 2012 +0200
@@ -65,7 +65,7 @@
 }
 
 IriSP.Widgets.Mediafragment.prototype.setHashToAnnotation = function(_annotationId) {
-    this.setHash( 'id', this.source.unNamespace(_annotationId) );
+    this.setHash( 'id', _annotationId );
 }
 
 IriSP.Widgets.Mediafragment.prototype.setHashToTime = function(_time) {
--- a/metadataplayer/metadataplayer/Polemic.js	Thu Jun 07 23:14:10 2012 +0200
+++ b/metadataplayer/metadataplayer/Polemic.js	Thu Jun 14 17:28:20 2012 +0200
@@ -169,13 +169,13 @@
                 var _y = _this.height;
                 _slice.annotations.forEach(function(_annotation) {
                     _y -= _this.element_height;
-                    displayElement(_x, _y, _this.defaultcolor, _annotation.namespacedId.name, _annotation.title);
+                    displayElement(_x, _y, _this.defaultcolor, _annotation.id, _annotation.title);
                 });
                 IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) {
                     var _color = _this.polemics[_j].color;
                     _annotations.forEach(function(_annotation) {
                         _y -= _this.element_height;
-                        displayElement(_x, _y, _color, _annotation.namespacedId.name, _annotation.title);
+                        displayElement(_x, _y, _color, _annotation.id, _annotation.title);
                     });
                 });
                 _x += _this.element_width;
--- a/metadataplayer/metadataplayer/Segments.js	Thu Jun 07 23:14:10 2012 +0200
+++ b/metadataplayer/metadataplayer/Segments.js	Thu Jun 14 17:28:20 2012 +0200
@@ -51,7 +51,7 @@
                 left : Math.floor( _left ),
                 width : Math.floor( _width ),
                 center : Math.floor( _center ),
-                id : _annotation.namespacedId.name
+                id : _annotation.id
             }
         })
     }));