1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-14 15:03:42 +01:00
Radarr/UI/Series/EpisodeModel.js

39 lines
999 B
JavaScript
Raw Normal View History

2013-06-22 08:24:24 +02:00
'use strict';
define(
[
'backbone',
'Series/SeriesModel'
], function (Backbone, SeriesModel) {
return Backbone.Model.extend({
2013-07-17 02:41:04 +02:00
initialize: function () {
if (this.has('series')) {
2013-06-05 03:04:34 +02:00
var start = Date.create(this.get('airDate'));
2013-07-17 02:41:04 +02:00
var runtime = this.get('series').get('runtime');
2013-05-01 03:54:15 +02:00
2013-07-17 02:41:04 +02:00
this.set('end', start.addMinutes(runtime));
}
2013-05-20 23:06:01 +02:00
},
2013-03-02 20:13:23 +01: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-10 04:10:15 +02:00
defaults: {
seasonNumber: 0,
status : 0
}
});
2013-03-02 20:13:23 +01:00
});