27 _res.setDuration(_data.meta["dc:duration"]); |
27 _res.setDuration(_data.meta["dc:duration"]); |
28 return _res; |
28 return _res; |
29 }, |
29 }, |
30 serializer : function(_data, _source) { |
30 serializer : function(_data, _source) { |
31 return { |
31 return { |
32 id : _source.unNamespace(_data.id), |
32 id : _data.id, |
33 url : _data.video, |
33 url : _data.video, |
34 meta : { |
34 meta : { |
35 "dc:title" : _data.title, |
35 "dc:title" : _data.title, |
36 "dc:description" : _data.description, |
36 "dc:description" : _data.description, |
37 "dc:duration" : _data.duration.milliseconds |
37 "dc:duration" : _data.duration.milliseconds |
64 _res.description = _data["dc:description"]; |
64 _res.description = _data["dc:description"]; |
65 return _res; |
65 return _res; |
66 }, |
66 }, |
67 serializer : function(_data, _source) { |
67 serializer : function(_data, _source) { |
68 return { |
68 return { |
69 id : _source.unNamespace(_data.id), |
69 id : _data.id, |
70 "dc:title" : _data.title, |
70 "dc:title" : _data.title, |
71 "dc:description" : _data.description |
71 "dc:description" : _data.description |
72 } |
72 } |
73 } |
73 } |
74 }, |
74 }, |
104 } |
104 } |
105 return _res; |
105 return _res; |
106 }, |
106 }, |
107 serializer : function(_data, _source) { |
107 serializer : function(_data, _source) { |
108 return { |
108 return { |
109 id : _source.unNamespace(_data.id), |
109 id : _data.id, |
110 begin : _data.begin.milliseconds, |
110 begin : _data.begin.milliseconds, |
111 end : _data.end.milliseconds, |
111 end : _data.end.milliseconds, |
112 content : { |
112 content : { |
113 title : _data.title, |
113 title : _data.title, |
114 description : _data.description, |
114 description : _data.description, |
115 audio : _data.audio |
115 audio : _data.audio |
116 }, |
116 }, |
117 media : _source.unNamespace(_data.media.id), |
117 media : _data.media.id, |
118 meta : { |
118 meta : { |
119 "id-ref" : _source.unNamespace(_data.annotationType.id), |
119 "id-ref" : _data.annotationType.id, |
120 "dc:created" : IriSP.Model.dateToIso(_data.created), |
120 "dc:created" : IriSP.Model.dateToIso(_data.created), |
121 "dc:creator" : _data.creator, |
121 "dc:creator" : _data.creator, |
122 project : _source.projectId |
122 project : _source.projectId |
123 }, |
123 }, |
124 tags : IriSP._(_data.tag.id).map(function(_id) { |
124 tags : IriSP._(_data.tag.id).map(function(_id) { |
125 return { |
125 return { |
126 "id-ref" : _source.unNamespace(_id) |
126 "id-ref" : _id |
127 } |
127 } |
128 }) |
128 }) |
129 } |
129 } |
130 } |
130 } |
131 }, |
131 }, |
143 serializer : function(_data, _source) { |
143 serializer : function(_data, _source) { |
144 return { |
144 return { |
145 "dc:title": _data.title, |
145 "dc:title": _data.title, |
146 "dc:description": _data.description, |
146 "dc:description": _data.description, |
147 segments: _data.segments.map(function(_annotation) { |
147 segments: _data.segments.map(function(_annotation) { |
148 return _source.unNamespace(_id); |
148 return _id; |
149 }) |
149 }) |
150 } |
150 } |
151 } |
151 } |
152 } |
152 } |
153 }, |
153 }, |
169 deSerialize : function(_data, _source) { |
169 deSerialize : function(_data, _source) { |
170 if (typeof _data !== "object" || _data === null) { |
170 if (typeof _data !== "object" || _data === null) { |
171 return; |
171 return; |
172 } |
172 } |
173 IriSP._(this.types).forEach(function(_type, _typename) { |
173 IriSP._(this.types).forEach(function(_type, _typename) { |
174 var _listdata = _data[_type.serialized_name]; |
174 var _listdata = _data[_type.serialized_name], |
|
175 _list = new IriSP.Model.List(_source.directory); |
175 if (typeof _listdata !== "undefined" && _listdata !== null) { |
176 if (typeof _listdata !== "undefined" && _listdata !== null) { |
176 var _list = new IriSP.Model.List(_source.directory); |
|
177 if (_listdata.hasOwnProperty("length")) { |
177 if (_listdata.hasOwnProperty("length")) { |
178 var _l = _listdata.length; |
178 var _l = _listdata.length; |
179 for (var _i = 0; _i < _l; _i++) { |
179 for (var _i = 0; _i < _l; _i++) { |
180 _list.push(_type.deserializer(_listdata[_i], _source)); |
180 _list.push(_type.deserializer(_listdata[_i], _source)); |
181 } |
181 } |
182 } else { |
182 } else { |
183 _list.push(_type.deserializer(_listdata, _source)); |
183 _list.push(_type.deserializer(_listdata, _source)); |
184 } |
184 } |
185 _source.addList(_typename, _list); |
|
186 } |
185 } |
|
186 _source.addList(_typename, _list); |
187 }); |
187 }); |
188 |
188 |
189 if (typeof _data.meta !== "undefined") { |
189 if (typeof _data.meta !== "undefined") { |
190 _source.projectId = _data.meta.id; |
190 _source.projectId = _data.meta.id; |
191 } |
191 } |