2013-03-30 19:30:00 +00:00
|
|
|
|
"use strict";
|
|
|
|
|
define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Quality/QualityProfileCollection'],
|
2013-02-15 02:40:29 +00:00
|
|
|
|
function (app, rootFolderCollection, qualityProfileCollection) {
|
2013-02-14 02:28:56 +00:00
|
|
|
|
|
2013-03-29 23:28:58 +00:00
|
|
|
|
NzbDrone.AddSeries.SearchResultModel = Backbone.Model.extend({
|
|
|
|
|
mutators: {
|
|
|
|
|
seriesYear: function () {
|
|
|
|
|
var date = Date.utc.create(this.get('firstAired')).format('({yyyy})');
|
2013-02-14 02:28:56 +00:00
|
|
|
|
|
2013-03-29 23:28:58 +00:00
|
|
|
|
//don't append year, if the series name already has the name appended.
|
|
|
|
|
if (this.get('title').endsWith(date)) {
|
|
|
|
|
return "";
|
|
|
|
|
} else {
|
|
|
|
|
return date;
|
|
|
|
|
}
|
2013-03-31 21:45:16 +00:00
|
|
|
|
},
|
|
|
|
|
banner : function () {
|
|
|
|
|
var banner = _.find(this.get('images'), function (image) {
|
|
|
|
|
return image.coverType === 1;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return banner.url;
|
|
|
|
|
},
|
|
|
|
|
traktUrl : function () {
|
|
|
|
|
return "http://trakt.tv/show/" + this.get('titleSlug');
|
2013-02-14 02:28:56 +00:00
|
|
|
|
}
|
2013-03-29 23:28:58 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
defaults: {
|
|
|
|
|
qualityProfiles: qualityProfileCollection,
|
|
|
|
|
rootFolders : rootFolderCollection
|
2013-01-26 21:20:17 +00:00
|
|
|
|
}
|
2013-02-14 02:28:56 +00:00
|
|
|
|
|
2013-03-29 23:28:58 +00:00
|
|
|
|
});
|
2013-01-27 03:04:15 +00:00
|
|
|
|
|
2013-02-14 02:28:56 +00:00
|
|
|
|
});
|