1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/UI/Series/EpisodeModel.js
2013-07-23 22:28:06 -07:00

40 lines
1.0 KiB
JavaScript

'use strict';
define(
[
'backbone',
'moment',
'Series/SeriesModel'
], function (Backbone, Moment, SeriesModel) {
return Backbone.Model.extend({
initialize: function () {
if (this.has('series')) {
var start = Moment(this.get('airDateUtc'));
var runtime = this.get('series').get('runtime');
this.set('end', start.add('minutes', 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
}
});
});