|
|
|
@ -16,302 +16,303 @@ require('backstrech');
|
|
|
|
|
require('../../Mixins/backbone.signalr.mixin');
|
|
|
|
|
|
|
|
|
|
module.exports = Marionette.Layout.extend({
|
|
|
|
|
itemViewContainer : '.x-movie-seasons',
|
|
|
|
|
template : 'Movies/Details/MoviesDetailsTemplate',
|
|
|
|
|
|
|
|
|
|
regions : {
|
|
|
|
|
seasons : '#seasons',
|
|
|
|
|
info : '#info',
|
|
|
|
|
search : '#movie-search',
|
|
|
|
|
history : '#movie-history',
|
|
|
|
|
files : "#movie-files"
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui : {
|
|
|
|
|
header : '.x-header',
|
|
|
|
|
monitored : '.x-monitored',
|
|
|
|
|
edit : '.x-edit',
|
|
|
|
|
refresh : '.x-refresh',
|
|
|
|
|
rename : '.x-rename',
|
|
|
|
|
searchAuto : '.x-search',
|
|
|
|
|
poster : '.x-movie-poster',
|
|
|
|
|
manualSearch : '.x-manual-search',
|
|
|
|
|
history : '.x-movie-history',
|
|
|
|
|
search : '.x-movie-search',
|
|
|
|
|
files : ".x-movie-files"
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
events : {
|
|
|
|
|
'click .x-episode-file-editor' : '_showFiles',
|
|
|
|
|
'click .x-monitored' : '_toggleMonitored',
|
|
|
|
|
'click .x-edit' : '_editMovie',
|
|
|
|
|
'click .x-refresh' : '_refreshMovies',
|
|
|
|
|
'click .x-rename' : '_renameMovies',
|
|
|
|
|
'click .x-search' : '_moviesSearch',
|
|
|
|
|
'click .x-manual-search' : '_showSearch',
|
|
|
|
|
'click .x-movie-history' : '_showHistory',
|
|
|
|
|
'click .x-movie-search' : '_showSearch',
|
|
|
|
|
"click .x-movie-files" : "_showFiles",
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
initialize : function() {
|
|
|
|
|
this.moviesCollection = MoviesCollection.clone();
|
|
|
|
|
this.moviesCollection.shadowCollection.bindSignalR();
|
|
|
|
|
|
|
|
|
|
this.listenTo(this.model, 'change:monitored', this._setMonitoredState);
|
|
|
|
|
this.listenTo(this.model, 'remove', this._moviesRemoved);
|
|
|
|
|
this.listenTo(vent, vent.Events.CommandComplete, this._commandComplete);
|
|
|
|
|
|
|
|
|
|
this.listenTo(this.model, 'change', function(model, options) {
|
|
|
|
|
if (options && options.changeSource === 'signalr') {
|
|
|
|
|
this._refresh();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.listenTo(this.model, 'change:images', this._updateImages);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onShow : function() {
|
|
|
|
|
this.searchLayout = new SearchLayout({ model : this.model });
|
|
|
|
|
this.searchLayout.startManualSearch = true;
|
|
|
|
|
|
|
|
|
|
this.filesLayout = new FilesLayout({ model : this.model });
|
|
|
|
|
|
|
|
|
|
this._showBackdrop();
|
|
|
|
|
this._showSeasons();
|
|
|
|
|
this._setMonitoredState();
|
|
|
|
|
this._showInfo();
|
|
|
|
|
if (this.model.get("movieFile")) {
|
|
|
|
|
this._showFiles()
|
|
|
|
|
} else {
|
|
|
|
|
this._showHistory();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onRender : function() {
|
|
|
|
|
CommandController.bindToCommand({
|
|
|
|
|
element : this.ui.refresh,
|
|
|
|
|
command : {
|
|
|
|
|
name : 'refreshMovie'
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CommandController.bindToCommand({
|
|
|
|
|
element : this.ui.searchAuto,
|
|
|
|
|
command : {
|
|
|
|
|
name : 'moviesSearch'
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CommandController.bindToCommand({
|
|
|
|
|
element : this.ui.rename,
|
|
|
|
|
command : {
|
|
|
|
|
name : 'renameMovieFiles',
|
|
|
|
|
movieId : this.model.id,
|
|
|
|
|
seasonNumber : -1
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onClose : function() {
|
|
|
|
|
if (this._backstrech) {
|
|
|
|
|
this._backstrech.destroy();
|
|
|
|
|
delete this._backstrech;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('body').removeClass('backdrop');
|
|
|
|
|
reqres.removeHandler(reqres.Requests.GetEpisodeFileById);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_getImage : function(type) {
|
|
|
|
|
var image = _.where(this.model.get('images'), { coverType : type });
|
|
|
|
|
|
|
|
|
|
if (image && image[0]) {
|
|
|
|
|
return image[0].url;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return undefined;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_showHistory : function(e) {
|
|
|
|
|
if (e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.ui.history.tab('show');
|
|
|
|
|
this.history.show(new HistoryLayout({
|
|
|
|
|
model : this.model
|
|
|
|
|
}));
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_showSearch : function(e) {
|
|
|
|
|
if (e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.ui.search.tab('show');
|
|
|
|
|
this.search.show(this.searchLayout);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_showFiles : function(e) {
|
|
|
|
|
if (e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.ui.files.tab('show');
|
|
|
|
|
this.files.show(this.filesLayout);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_toggleMonitored : function() {
|
|
|
|
|
var savePromise = this.model.save('monitored', !this.model.get('monitored'), { wait : true });
|
|
|
|
|
|
|
|
|
|
this.ui.monitored.spinForPromise(savePromise);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_setMonitoredState : function() {
|
|
|
|
|
var monitored = this.model.get('monitored');
|
|
|
|
|
|
|
|
|
|
this.ui.monitored.removeAttr('data-idle-icon');
|
|
|
|
|
this.ui.monitored.removeClass('fa-spin icon-sonarr-spinner');
|
|
|
|
|
|
|
|
|
|
if (monitored) {
|
|
|
|
|
this.ui.monitored.addClass('icon-sonarr-monitored');
|
|
|
|
|
this.ui.monitored.removeClass('icon-sonarr-unmonitored');
|
|
|
|
|
this.$el.removeClass('movie-not-monitored');
|
|
|
|
|
} else {
|
|
|
|
|
this.ui.monitored.addClass('icon-sonarr-unmonitored');
|
|
|
|
|
this.ui.monitored.removeClass('icon-sonarr-monitored');
|
|
|
|
|
this.$el.addClass('movie-not-monitored');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_editMovie : function() {
|
|
|
|
|
vent.trigger(vent.Commands.EditMovieCommand, { movie : this.model });
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_refreshMovies : function() {
|
|
|
|
|
CommandController.Execute('refreshMovie', {
|
|
|
|
|
name : 'refreshMovie',
|
|
|
|
|
movieId : this.model.id
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_moviesRemoved : function() {
|
|
|
|
|
Backbone.history.navigate('/', { trigger : true });
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_renameMovies : function() {
|
|
|
|
|
vent.trigger(vent.Commands.ShowRenamePreview, { movie : this.model });
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_moviesSearch : function() {
|
|
|
|
|
CommandController.Execute('moviesSearch', {
|
|
|
|
|
name : 'moviesSearch',
|
|
|
|
|
movieIds : [this.model.id]
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_showSeasons : function() {
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
reqres.setHandler(reqres.Requests.GetEpisodeFileById, function(episodeFileId) {
|
|
|
|
|
return self.episodeFileCollection.get(episodeFileId);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
reqres.setHandler(reqres.Requests.GetAlternateNameBySeasonNumber, function(moviesId, seasonNumber, sceneSeasonNumber) {
|
|
|
|
|
if (self.model.get('id') !== moviesId) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sceneSeasonNumber === undefined) {
|
|
|
|
|
sceneSeasonNumber = seasonNumber;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _.where(self.model.get('alternateTitles'),
|
|
|
|
|
function(alt) {
|
|
|
|
|
return alt.sceneSeasonNumber === sceneSeasonNumber || alt.seasonNumber === seasonNumber;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$.when(this.episodeCollection.fetch(), this.episodeFileCollection.fetch()).done(function() {
|
|
|
|
|
var seasonCollectionView = new SeasonCollectionView({
|
|
|
|
|
collection : self.seasonCollection,
|
|
|
|
|
episodeCollection : self.episodeCollection,
|
|
|
|
|
movies : self.model
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!self.isClosed) {
|
|
|
|
|
self.seasons.show(seasonCollectionView);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_showInfo : function() {
|
|
|
|
|
this.info.show(new InfoView({
|
|
|
|
|
model : this.model
|
|
|
|
|
}));
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_commandComplete : function(options) {
|
|
|
|
|
if (options.command.get('name') === 'renameMoviefiles') {
|
|
|
|
|
if (options.command.get('moviesId') === this.model.get('id')) {
|
|
|
|
|
this._refresh();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_refresh : function() {
|
|
|
|
|
//this.seasonCollection.add(this.model.get('seasons'), { merge : true });
|
|
|
|
|
//this.episodeCollection.fetch();
|
|
|
|
|
//this.episodeFileCollection.fetch();
|
|
|
|
|
|
|
|
|
|
this._setMonitoredState();
|
|
|
|
|
this._showInfo();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_openEpisodeFileEditor : function() {
|
|
|
|
|
var view = new EpisodeFileEditorLayout({
|
|
|
|
|
movies : this.model,
|
|
|
|
|
episodeCollection : this.episodeCollection
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
vent.trigger(vent.Commands.OpenModalCommand, view);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_updateImages : function () {
|
|
|
|
|
var poster = this._getImage('poster');
|
|
|
|
|
|
|
|
|
|
if (poster) {
|
|
|
|
|
this.ui.poster.attr('src', poster);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._showBackdrop();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_showBackdrop : function () {
|
|
|
|
|
$('body').addClass('backdrop');
|
|
|
|
|
var fanArt = this._getImage('banner');
|
|
|
|
|
|
|
|
|
|
if (fanArt) {
|
|
|
|
|
this._backstrech = $.backstretch(fanArt);
|
|
|
|
|
} else {
|
|
|
|
|
$('body').removeClass('backdrop');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_manualSearchM : function() {
|
|
|
|
|
console.warn("Manual Search started");
|
|
|
|
|
console.warn(this.model.id);
|
|
|
|
|
console.warn(this.model)
|
|
|
|
|
console.warn(this.episodeCollection);
|
|
|
|
|
vent.trigger(vent.Commands.ShowEpisodeDetails, {
|
|
|
|
|
episode : this.model,
|
|
|
|
|
hideMoviesLink : true,
|
|
|
|
|
openingTab : 'search'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
itemViewContainer : '.x-movie-seasons',
|
|
|
|
|
template : 'Movies/Details/MoviesDetailsTemplate',
|
|
|
|
|
|
|
|
|
|
regions : {
|
|
|
|
|
seasons : '#seasons',
|
|
|
|
|
info : '#info',
|
|
|
|
|
search : '#movie-search',
|
|
|
|
|
history : '#movie-history',
|
|
|
|
|
files : "#movie-files"
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui : {
|
|
|
|
|
header : '.x-header',
|
|
|
|
|
monitored : '.x-monitored',
|
|
|
|
|
edit : '.x-edit',
|
|
|
|
|
refresh : '.x-refresh',
|
|
|
|
|
rename : '.x-rename',
|
|
|
|
|
searchAuto : '.x-search',
|
|
|
|
|
poster : '.x-movie-poster',
|
|
|
|
|
manualSearch : '.x-manual-search',
|
|
|
|
|
history : '.x-movie-history',
|
|
|
|
|
search : '.x-movie-search',
|
|
|
|
|
files : ".x-movie-files"
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
events : {
|
|
|
|
|
'click .x-episode-file-editor' : '_showFiles',
|
|
|
|
|
'click .x-monitored' : '_toggleMonitored',
|
|
|
|
|
'click .x-edit' : '_editMovie',
|
|
|
|
|
'click .x-refresh' : '_refreshMovies',
|
|
|
|
|
'click .x-rename' : '_renameMovies',
|
|
|
|
|
'click .x-search' : '_moviesSearch',
|
|
|
|
|
'click .x-manual-search' : '_showSearch',
|
|
|
|
|
'click .x-movie-history' : '_showHistory',
|
|
|
|
|
'click .x-movie-search' : '_showSearch',
|
|
|
|
|
"click .x-movie-files" : "_showFiles",
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
initialize : function() {
|
|
|
|
|
this.moviesCollection = MoviesCollection.clone();
|
|
|
|
|
this.moviesCollection.shadowCollection.bindSignalR();
|
|
|
|
|
|
|
|
|
|
this.listenTo(this.model, 'change:monitored', this._setMonitoredState);
|
|
|
|
|
this.listenTo(this.model, 'remove', this._moviesRemoved);
|
|
|
|
|
this.listenTo(this.model, "change:movieFile", this._refreshFiles);
|
|
|
|
|
|
|
|
|
|
this.listenTo(vent, vent.Events.CommandComplete, this._commandComplete);
|
|
|
|
|
|
|
|
|
|
this.listenTo(this.model, 'change', function(model, options) {
|
|
|
|
|
if (options && options.changeSource === 'signalr') {
|
|
|
|
|
this._refresh();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.listenTo(this.model, 'change:images', this._updateImages);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onShow : function() {
|
|
|
|
|
this.searchLayout = new SearchLayout({ model : this.model });
|
|
|
|
|
this.searchLayout.startManualSearch = true;
|
|
|
|
|
|
|
|
|
|
this.filesLayout = new FilesLayout({ model : this.model });
|
|
|
|
|
|
|
|
|
|
this._showBackdrop();
|
|
|
|
|
this._showSeasons();
|
|
|
|
|
this._setMonitoredState();
|
|
|
|
|
this._showInfo();
|
|
|
|
|
if (this.model.get("movieFile")) {
|
|
|
|
|
this._showFiles()
|
|
|
|
|
} else {
|
|
|
|
|
this._showHistory();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onRender : function() {
|
|
|
|
|
CommandController.bindToCommand({
|
|
|
|
|
element : this.ui.refresh,
|
|
|
|
|
command : {
|
|
|
|
|
name : 'refreshMovie'
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CommandController.bindToCommand({
|
|
|
|
|
element : this.ui.searchAuto,
|
|
|
|
|
command : {
|
|
|
|
|
name : 'moviesSearch'
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
CommandController.bindToCommand({
|
|
|
|
|
element : this.ui.rename,
|
|
|
|
|
command : {
|
|
|
|
|
name : 'renameMovieFiles',
|
|
|
|
|
movieId : this.model.id,
|
|
|
|
|
seasonNumber : -1
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onClose : function() {
|
|
|
|
|
if (this._backstrech) {
|
|
|
|
|
this._backstrech.destroy();
|
|
|
|
|
delete this._backstrech;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('body').removeClass('backdrop');
|
|
|
|
|
reqres.removeHandler(reqres.Requests.GetEpisodeFileById);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_getImage : function(type) {
|
|
|
|
|
var image = _.where(this.model.get('images'), { coverType : type });
|
|
|
|
|
|
|
|
|
|
if (image && image[0]) {
|
|
|
|
|
return image[0].url;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return undefined;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_showHistory : function(e) {
|
|
|
|
|
if (e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.ui.history.tab('show');
|
|
|
|
|
this.history.show(new HistoryLayout({
|
|
|
|
|
model : this.model
|
|
|
|
|
}));
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_showSearch : function(e) {
|
|
|
|
|
if (e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.ui.search.tab('show');
|
|
|
|
|
this.search.show(this.searchLayout);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_showFiles : function(e) {
|
|
|
|
|
if (e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.ui.files.tab('show');
|
|
|
|
|
this.files.show(this.filesLayout);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_toggleMonitored : function() {
|
|
|
|
|
var savePromise = this.model.save('monitored', !this.model.get('monitored'), { wait : true });
|
|
|
|
|
|
|
|
|
|
this.ui.monitored.spinForPromise(savePromise);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_setMonitoredState : function() {
|
|
|
|
|
var monitored = this.model.get('monitored');
|
|
|
|
|
|
|
|
|
|
this.ui.monitored.removeAttr('data-idle-icon');
|
|
|
|
|
this.ui.monitored.removeClass('fa-spin icon-sonarr-spinner');
|
|
|
|
|
|
|
|
|
|
if (monitored) {
|
|
|
|
|
this.ui.monitored.addClass('icon-sonarr-monitored');
|
|
|
|
|
this.ui.monitored.removeClass('icon-sonarr-unmonitored');
|
|
|
|
|
this.$el.removeClass('movie-not-monitored');
|
|
|
|
|
} else {
|
|
|
|
|
this.ui.monitored.addClass('icon-sonarr-unmonitored');
|
|
|
|
|
this.ui.monitored.removeClass('icon-sonarr-monitored');
|
|
|
|
|
this.$el.addClass('movie-not-monitored');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_editMovie : function() {
|
|
|
|
|
vent.trigger(vent.Commands.EditMovieCommand, { movie : this.model });
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_refreshMovies : function() {
|
|
|
|
|
CommandController.Execute('refreshMovie', {
|
|
|
|
|
name : 'refreshMovie',
|
|
|
|
|
movieId : this.model.id
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_moviesRemoved : function() {
|
|
|
|
|
Backbone.history.navigate('/', { trigger : true });
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_renameMovies : function() {
|
|
|
|
|
vent.trigger(vent.Commands.ShowRenamePreview, { movie : this.model });
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_moviesSearch : function() {
|
|
|
|
|
CommandController.Execute('moviesSearch', {
|
|
|
|
|
name : 'moviesSearch',
|
|
|
|
|
movieIds : [this.model.id]
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_showSeasons : function() {
|
|
|
|
|
var self = this;
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
reqres.setHandler(reqres.Requests.GetEpisodeFileById, function(episodeFileId) {
|
|
|
|
|
return self.episodeFileCollection.get(episodeFileId);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
reqres.setHandler(reqres.Requests.GetAlternateNameBySeasonNumber, function(moviesId, seasonNumber, sceneSeasonNumber) {
|
|
|
|
|
if (self.model.get('id') !== moviesId) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sceneSeasonNumber === undefined) {
|
|
|
|
|
sceneSeasonNumber = seasonNumber;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _.where(self.model.get('alternateTitles'),
|
|
|
|
|
function(alt) {
|
|
|
|
|
return alt.sceneSeasonNumber === sceneSeasonNumber || alt.seasonNumber === seasonNumber;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$.when(this.episodeCollection.fetch(), this.episodeFileCollection.fetch()).done(function() {
|
|
|
|
|
var seasonCollectionView = new SeasonCollectionView({
|
|
|
|
|
collection : self.seasonCollection,
|
|
|
|
|
episodeCollection : self.episodeCollection,
|
|
|
|
|
movies : self.model
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (!self.isClosed) {
|
|
|
|
|
self.seasons.show(seasonCollectionView);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_showInfo : function() {
|
|
|
|
|
this.info.show(new InfoView({
|
|
|
|
|
model : this.model
|
|
|
|
|
}));
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_commandComplete : function(options) {
|
|
|
|
|
if (options.command.get('name') === 'renameMoviefiles') {
|
|
|
|
|
if (options.command.get('moviesId') === this.model.get('id')) {
|
|
|
|
|
this._refresh();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_refresh : function() {
|
|
|
|
|
//this.seasonCollection.add(this.model.get('seasons'), { merge : true });
|
|
|
|
|
//this.episodeCollection.fetch();
|
|
|
|
|
//this.episodeFileCollection.fetch();
|
|
|
|
|
this._setMonitoredState();
|
|
|
|
|
this._showInfo();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_openEpisodeFileEditor : function() {
|
|
|
|
|
var view = new EpisodeFileEditorLayout({
|
|
|
|
|
movies : this.model,
|
|
|
|
|
episodeCollection : this.episodeCollection
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
vent.trigger(vent.Commands.OpenModalCommand, view);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_updateImages : function () {
|
|
|
|
|
var poster = this._getImage('poster');
|
|
|
|
|
|
|
|
|
|
if (poster) {
|
|
|
|
|
this.ui.poster.attr('src', poster);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._showBackdrop();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_showBackdrop : function () {
|
|
|
|
|
$('body').addClass('backdrop');
|
|
|
|
|
var fanArt = this._getImage('banner');
|
|
|
|
|
|
|
|
|
|
if (fanArt) {
|
|
|
|
|
this._backstrech = $.backstretch(fanArt);
|
|
|
|
|
} else {
|
|
|
|
|
$('body').removeClass('backdrop');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_manualSearchM : function() {
|
|
|
|
|
console.warn("Manual Search started");
|
|
|
|
|
console.warn(this.model.id);
|
|
|
|
|
console.warn(this.model)
|
|
|
|
|
console.warn(this.episodeCollection);
|
|
|
|
|
vent.trigger(vent.Commands.ShowEpisodeDetails, {
|
|
|
|
|
episode : this.model,
|
|
|
|
|
hideMoviesLink : true,
|
|
|
|
|
openingTab : 'search'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|