equal
deleted
inserted
replaced
|
1 IriSP.serializers.segmentapi = { |
|
2 deSerialize : function(_data, _source) { |
|
3 var _annotationlist = new IriSP.Model.List(_source.directory), |
|
4 _medialist = new IriSP.Model.List(_source.directory); |
|
5 _source.addList("media", _medialist); |
|
6 |
|
7 function deserializeObject(_s) { |
|
8 var _ann = new IriSP.Model.Annotation(_s.element_id, _source), |
|
9 _media = _source.getElement(_s.iri_id); |
|
10 if (!_media) { |
|
11 _media = new IriSP.Model.Media(_s.iri_id, _source); |
|
12 _source.getMedias().push(_media); |
|
13 } |
|
14 _ann.setMedia(_s.iri_id); |
|
15 _ann.title = _s.title; |
|
16 _ann.description = _s.abstract; |
|
17 _ann.begin = new IriSP.Model.Time(_s.start_ts); |
|
18 _ann.end = new IriSP.Model.Time(_s.start_ts + _s.duration); |
|
19 _ann.keywords = (_s.tags ? _s.tags.split(",") : []); |
|
20 _ann.project_id = _s.project_id; |
|
21 _annotationlist.push(_ann); |
|
22 } |
|
23 |
|
24 if (typeof _data.objects !== "undefined") { |
|
25 IriSP._(_data.objects).each(deserializeObject); |
|
26 } else { |
|
27 deserializeObject(_data); |
|
28 } |
|
29 _source.addList("annotation", _annotationlist); |
|
30 } |
|
31 }; |
|
32 |
|
33 /* END segmentapi-serializer.js */ |