mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 17:13:49 -07:00
removed mutators from series.
This commit is contained in:
parent
50718ae94e
commit
83fe07524a
13 changed files with 97 additions and 80 deletions
|
@ -2,71 +2,13 @@
|
|||
define(
|
||||
[
|
||||
'backbone',
|
||||
'Quality/QualityProfileCollection',
|
||||
|
||||
'underscore'
|
||||
], function (Backbone, QualityProfileCollection,_) {
|
||||
], function (Backbone, _) {
|
||||
return Backbone.Model.extend({
|
||||
|
||||
urlRoot: ApiRoot + '/series',
|
||||
|
||||
mutators: {
|
||||
percentOfEpisodes: function () {
|
||||
var episodeCount = this.get('episodeCount');
|
||||
var episodeFileCount = this.get('episodeFileCount');
|
||||
|
||||
var percent = 100;
|
||||
|
||||
if (episodeCount > 0) {
|
||||
percent = episodeFileCount / episodeCount * 100;
|
||||
}
|
||||
|
||||
return percent;
|
||||
},
|
||||
poster : function () {
|
||||
var poster = _.find(this.get('images'), function (image) {
|
||||
return image.coverType === 'poster';
|
||||
});
|
||||
|
||||
if (poster) {
|
||||
return poster.url;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
fanArt : function () {
|
||||
var poster = _.find(this.get('images'), function (image) {
|
||||
return image.coverType === 'fanart';
|
||||
});
|
||||
|
||||
if (poster) {
|
||||
return poster.url;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
},
|
||||
traktUrl : function () {
|
||||
return 'http://trakt.tv/show/' + this.get('titleSlug');
|
||||
},
|
||||
imdbUrl : function () {
|
||||
return 'http://imdb.com/title/' + this.get('imdbId');
|
||||
},
|
||||
isContinuing : function () {
|
||||
return this.get('status') === 'continuing';
|
||||
},
|
||||
route : function () {
|
||||
return '/series/' + this.get('titleSlug');
|
||||
},
|
||||
|
||||
qualityProfile: function () {
|
||||
var profile = QualityProfileCollection.get(this.get('qualityProfileId'));
|
||||
if (profile) {
|
||||
return profile.toJSON();
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
},
|
||||
|
||||
defaults: {
|
||||
episodeFileCount: 0,
|
||||
episodeCount : 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue