--- a/src/js/serializers/JSONSerializer.js Tue Apr 03 20:30:12 2012 +0200
+++ b/src/js/serializers/JSONSerializer.js Fri Apr 06 16:49:32 2012 +0200
@@ -21,7 +21,7 @@
/** load JSON-cinelab data and also sort the annotations by start time
@param callback function to call when the data is ready.
*/
-IriSP.JSONSerializer.prototype.sync = function(callback) {
+IriSP.JSONSerializer.prototype.sync = function(callback, force_refresh) {
/* we don't have to do much because jQuery handles json for us */
var self = this;
@@ -43,15 +43,23 @@
}
callback(data);
};
-
- this._DataLoader.get(this._url, fn);
+ this._DataLoader.get(this._url, fn, force_refresh);
};
/** @return the metadata about the media being read FIXME: always return the first media. */
IriSP.JSONSerializer.prototype.currentMedia = function() {
- return this._data.medias[0]; /* FIXME: don't hardcode it */
+ return (typeof this._data.medias == "object" && this._data.medias.length) ? this._data.medias[0] : IriSP.__jsonMetadata.medias[0];
};
+IriSP.JSONSerializer.prototype.getDuration = function() {
+ var _m = this.currentMedia();
+ if (_m === null || typeof _m.meta == "undefined") {
+ return 0;
+ }
+ return +(IriSP.get_aliased(_m.meta, ["dc:duration", "duration"]) || 0);
+}
+
+
/** searches for an annotation which matches title, description and keyword
"" matches any field.
Note: it ignores tweets.
@@ -432,8 +440,4 @@
val = this.getId("Publ");
return val;
-};
-
-IriSP.JSONSerializer.prototype.getDuration = function() {
- return +(IriSP.get_aliased(this.currentMedia().meta, ["dc:duration", "duration"]) || 0);
-}
+};
\ No newline at end of file