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