1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-28 10:48:46 +00:00
Sonarr/UI/Series/EpisodeModel.js
2013-07-16 17:41:04 -07:00

38 lines
999 B
JavaScript

'use strict';
define(
[
'backbone',
'Series/SeriesModel'
], function (Backbone, SeriesModel) {
return Backbone.Model.extend({
initialize: function () {
if (this.has('series')) {
var start = Date.create(this.get('airDate'));
var runtime = this.get('series').get('runtime');
this.set('end', start.addMinutes(runtime));
}
},
parse: function (model) {
model.series = new SeriesModel(model.series);
return model;
},
toJSON: function () {
var json = _.clone(this.attributes);
if (this.has('series')) {
json.series = this.get('series').toJSON();
}
return json;
},
defaults: {
seasonNumber: 0,
status : 0
}
});
});