1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2025-03-04 02:28:21 +00:00
Sonarr/UI/Series/EpisodeModel.js

40 lines
1 KiB
JavaScript
Raw Normal View History

2013-06-21 23:24:24 -07:00
'use strict';
define(
[
'backbone',
'moment',
'Series/SeriesModel'
], function (Backbone, Moment, SeriesModel) {
return Backbone.Model.extend({
2013-07-16 17:41:04 -07:00
initialize: function () {
if (this.has('series')) {
2013-07-23 22:28:06 -07:00
var start = Moment(this.get('airDateUtc'));
2013-07-16 17:41:04 -07:00
var runtime = this.get('series').get('runtime');
2013-04-30 18:54:15 -07:00
this.set('end', start.add('minutes', runtime));
}
2013-05-20 14:06:01 -07:00
},
2013-03-02 11:13:23 -08:00
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;
},
2013-06-09 19:10:15 -07:00
defaults: {
seasonNumber: 0,
status : 0
}
});
2013-03-02 11:13:23 -08:00
});