Quality of an existing movie file can now be edited.

pull/2/head
Leonardo Galli 8 years ago
parent c6912a193c
commit 5e9a79afe8

@ -35,21 +35,21 @@ namespace NzbDrone.Api.EpisodeFiles
_seriesService = seriesService; _seriesService = seriesService;
_qualityUpgradableSpecification = qualityUpgradableSpecification; _qualityUpgradableSpecification = qualityUpgradableSpecification;
_logger = logger; _logger = logger;
/*GetResourceById = GetEpisodeFile; GetResourceById = GetMovieFile;
GetResourceAll = GetEpisodeFiles; /*GetResourceAll = GetEpisodeFiles;
UpdateResource = SetQuality;*/ UpdateResource = SetQuality;*/
UpdateResource = SetQuality;
DeleteResource = DeleteEpisodeFile; DeleteResource = DeleteEpisodeFile;
} }
/*private EpisodeFileResource GetEpisodeFile(int id) private MovieFileResource GetMovieFile(int id)
{ {
var episodeFile = _mediaFileService.Get(id); var episodeFile = _mediaFileService.GetMovie(id);
var series = _seriesService.GetSeries(episodeFile.SeriesId);
return episodeFile.ToResource(series, _qualityUpgradableSpecification); return episodeFile.ToResource();
} }
private List<EpisodeFileResource> GetEpisodeFiles() /*private List<EpisodeFileResource> GetEpisodeFiles()
{ {
if (!Request.Query.SeriesId.HasValue) if (!Request.Query.SeriesId.HasValue)
{ {
@ -62,13 +62,13 @@ namespace NzbDrone.Api.EpisodeFiles
return _mediaFileService.GetFilesBySeries(seriesId).ConvertAll(f => f.ToResource(series, _qualityUpgradableSpecification)); return _mediaFileService.GetFilesBySeries(seriesId).ConvertAll(f => f.ToResource(series, _qualityUpgradableSpecification));
} }
*/
private void SetQuality(EpisodeFileResource episodeFileResource) private void SetQuality(MovieFileResource episodeFileResource)
{ {
var episodeFile = _mediaFileService.Get(episodeFileResource.Id); var episodeFile = _mediaFileService.GetMovie(episodeFileResource.Id);
episodeFile.Quality = episodeFileResource.Quality; episodeFile.Quality = episodeFileResource.Quality;
_mediaFileService.Update(episodeFile); _mediaFileService.Update(episodeFile);
}*/ }
private void DeleteEpisodeFile(int id) private void DeleteEpisodeFile(int id)
{ {

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

@ -0,0 +1,32 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>{{relativePath}}</h3>
</div>
<div class="modal-body edit-series-modal">
<div class="row">
<div class="col-sm-12">
<div class="form-horizontal">
<div class="form-group">
<label class="col-sm-4 control-label">Quality</label>
<div class="col-sm-4">
<select class="form-control x-quality" id="inputProfile" name="qualityId">
{{#each qualities}}
<option value="{{quality.id}}">{{quality.name}}</option>
{{/each}}
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<span class="indicator x-indicator"><i class="icon-sonarr-spinner fa-spin"></i></span>
<button class="btn" data-dismiss="modal">Cancel</button>
<button class="btn btn-primary x-save">Save</button>
</div>
</div>

@ -0,0 +1,60 @@
var vent = require('vent');
var Marionette = require('marionette');
var Qualities = require('../../../Quality/QualityDefinitionCollection');
var AsModelBoundView = require('../../../Mixins/AsModelBoundView');
var AsValidatedView = require('../../../Mixins/AsValidatedView');
var AsEditModalView = require('../../../Mixins/AsEditModalView');
require('../../../Mixins/TagInput');
require('../../../Mixins/FileBrowser');
var view = Marionette.ItemView.extend({
template : 'Movies/Files/Edit/EditFileTemplate',
ui : {
quality : '.x-quality',
path : '.x-path',
tags : '.x-tags'
},
events : {
},
initialize : function() {
this.qualities = new Qualities();
var self = this;
this.listenTo(this.qualities, 'all', this._qualitiesUpdated);
this.qualities.fetch()
},
onRender : function() {
this.ui.quality.val(this.model.get("quality").quality.id)
},
_onBeforeSave : function() {
var qualityId = this.ui.quality.val();
var quality = this.qualities.find(function(m){return m.get("quality").id == qualityId}).get("quality");
var mQuality = this.model.get("quality");
mQuality.quality = quality;
this.model.set({ quality : mQuality });
},
_qualitiesUpdated : function() {
this.templateHelpers = {};
this.templateHelpers.qualities = this.qualities.toJSON();
this.render();
},
_onAfterSave : function() {
this.trigger('saved');
vent.trigger(vent.Commands.CloseModalCommand);
},
});
AsModelBoundView.call(view);
AsValidatedView.call(view);
AsEditModalView.call(view);
module.exports = view;

@ -0,0 +1,22 @@
var vent = require('vent');
var Backgrid = require('backgrid');
module.exports = Backgrid.Cell.extend({
className : 'edit-episode-file-cell',
events : {
'click' : '_onClick'
},
render : function() {
this.$el.empty();
this.$el.html('<i class="icon-sonarr-edit" title="Edit information about this file."></i>');
return this;
},
_onClick : function() {
var self = this;
vent.trigger(vent.Commands.EditFileCommand, { file : this.model });
}
});

@ -19,89 +19,117 @@ var ProtocolCell = require('../../Release/ProtocolCell');
var PeersCell = require('../../Release/PeersCell'); var PeersCell = require('../../Release/PeersCell');
var EditionCell = require('../../Cells/EditionCell'); var EditionCell = require('../../Cells/EditionCell');
var DeleteFileCell = require("./DeleteFileCell"); var DeleteFileCell = require("./DeleteFileCell");
var EditFileCell = require("./EditFileCell");
module.exports = Marionette.Layout.extend({ module.exports = Marionette.Layout.extend({
template : 'Movies/Files/FilesLayoutTemplate', template : 'Movies/Files/FilesLayoutTemplate',
regions : { regions : {
main : '#movie-files-region', main : '#movie-files-region',
grid : "#movie-files-grid" grid : "#movie-files-grid"
}, },
events : { events : {
'click .x-search-auto' : '_searchAuto', 'click .x-search-auto' : '_searchAuto',
'click .x-search-manual' : '_searchManual', 'click .x-search-manual' : '_searchManual',
'click .x-search-back' : '_showButtons' 'click .x-search-back' : '_showButtons'
}, },
columns : [ columns : [
{ {
name : 'title', name : 'title',
label : 'Title', label : 'Title',
cell : FileTitleCell cell : FileTitleCell
}, },
{ {
name : "mediaInfo", name : "mediaInfo",
label : "Media Info", label : "Media Info",
cell : MediaInfoCell cell : MediaInfoCell
}, },
{ {
name : 'edition', name : 'edition',
label : 'Edition', label : 'Edition',
cell : EditionCell, cell : EditionCell,
title : "Edition", title : "Edition",
}, },
{ {
name : 'size', name : 'size',
label : 'Size', label : 'Size',
cell : FileSizeCell cell : FileSizeCell
}, },
{ {
name : 'quality', name : 'quality',
label : 'Quality', label : 'Quality',
cell : QualityCell, cell : QualityCell,
}, },
{ {
name : "delete", name : "delete",
label : "", label : "",
cell : DeleteFileCell, cell : DeleteFileCell,
} },
], {
name : "edit",
label : "",
cell : EditFileCell,
}
],
initialize : function(movie) { initialize : function(movie) {
this.filesCollection = new FilesCollection(); this.filesCollection = new FilesCollection();
var file = movie.model.get("movieFile"); var file = movie.model.get("movieFile");
this.filesCollection.add(file); this.movie = movie;
//this.listenTo(this.releaseCollection, 'sync', this._showSearchResults); this.filesCollection.add(file);
}, //this.listenTo(this.releaseCollection, 'sync', this._showSearchResults);
this.listenTo(this.model, 'change', function(model, options) {
if (options && options.changeSource === 'signalr') {
this._refresh(movie);
}
});
onShow : function() { vent.on(vent.Commands.CloseModalCommand, this._refreshClose, this);
this.grid.show(new Backgrid.Grid({ },
row : Backgrid.Row,
columns : this.columns,
collection : this.filesCollection,
className : 'table table-hover'
}));
},
_showMainView : function() { _refresh : function(movie) {
this.main.show(this.mainView); this.filesCollection = new FilesCollection();
}, var file = movie.model.get("movieFile");
this.filesCollection.add(file);
this.onShow();
},
_showButtons : function() { _refreshClose : function(options) {
this._showMainView(); this.filesCollection = new FilesCollection();
}, var file = this.movie.model.get("movieFile");
this.filesCollection.add(file);
this.onShow();
},
_showSearchResults : function() { onShow : function() {
if (this.releaseCollection.length === 0) { this.grid.show(new Backgrid.Grid({
this.mainView = new NoResultsView(); row : Backgrid.Row,
} columns : this.columns,
collection : this.filesCollection,
className : 'table table-hover'
}));
},
else { _showMainView : function() {
//this.mainView = new ManualSearchLayout({ collection : this.releaseCollection }); this.main.show(this.mainView);
} },
this._showMainView(); _showButtons : function() {
} this._showMainView();
},
_showSearchResults : function() {
if (this.releaseCollection.length === 0) {
this.mainView = new NoResultsView();
}
else {
//this.mainView = new ManualSearchLayout({ collection : this.releaseCollection });
}
this._showMainView();
}
}); });

@ -11,101 +11,108 @@ var RenamePreviewLayout = require('../../Rename/RenamePreviewLayout');
var ManualImportLayout = require('../../ManualImport/ManualImportLayout'); var ManualImportLayout = require('../../ManualImport/ManualImportLayout');
var FileBrowserLayout = require('../FileBrowser/FileBrowserLayout'); var FileBrowserLayout = require('../FileBrowser/FileBrowserLayout');
var MoviesDetailsLayout = require('../../Movies/Details/MoviesDetailsLayout'); var MoviesDetailsLayout = require('../../Movies/Details/MoviesDetailsLayout');
var EditFileView = require("../../Movies/Files/Edit/EditFileView");
module.exports = Marionette.AppRouter.extend({ module.exports = Marionette.AppRouter.extend({
initialize : function() { initialize : function() {
vent.on(vent.Commands.OpenModalCommand, this._openModal, this); vent.on(vent.Commands.OpenModalCommand, this._openModal, this);
vent.on(vent.Commands.CloseModalCommand, this._closeModal, this); vent.on(vent.Commands.CloseModalCommand, this._closeModal, this);
vent.on(vent.Commands.OpenModal2Command, this._openModal2, this); vent.on(vent.Commands.OpenModal2Command, this._openModal2, this);
vent.on(vent.Commands.CloseModal2Command, this._closeModal2, this); vent.on(vent.Commands.CloseModal2Command, this._closeModal2, this);
vent.on(vent.Commands.EditSeriesCommand, this._editSeries, this); vent.on(vent.Commands.EditSeriesCommand, this._editSeries, this);
vent.on(vent.Commands.EditMovieCommand, this._editMovie, this); vent.on(vent.Commands.EditMovieCommand, this._editMovie, this);
vent.on(vent.Commands.DeleteSeriesCommand, this._deleteSeries, this); vent.on(vent.Commands.EditFileCommand, this._editFile, this);
vent.on(vent.Commands.ShowEpisodeDetails, this._showEpisode, this); vent.on(vent.Commands.DeleteSeriesCommand, this._deleteSeries, this);
vent.on(vent.Commands.ShowMovieDetails, this._showMovie, this); vent.on(vent.Commands.ShowEpisodeDetails, this._showEpisode, this);
vent.on(vent.Commands.ShowHistoryDetails, this._showHistory, this); vent.on(vent.Commands.ShowMovieDetails, this._showMovie, this);
vent.on(vent.Commands.ShowLogDetails, this._showLogDetails, this); vent.on(vent.Commands.ShowHistoryDetails, this._showHistory, this);
vent.on(vent.Commands.ShowRenamePreview, this._showRenamePreview, this); vent.on(vent.Commands.ShowLogDetails, this._showLogDetails, this);
vent.on(vent.Commands.ShowManualImport, this._showManualImport, this); vent.on(vent.Commands.ShowRenamePreview, this._showRenamePreview, this);
vent.on(vent.Commands.ShowFileBrowser, this._showFileBrowser, this); vent.on(vent.Commands.ShowManualImport, this._showManualImport, this);
vent.on(vent.Commands.CloseFileBrowser, this._closeFileBrowser, this); vent.on(vent.Commands.ShowFileBrowser, this._showFileBrowser, this);
}, vent.on(vent.Commands.CloseFileBrowser, this._closeFileBrowser, this);
},
_openModal : function(view) {
AppLayout.modalRegion.show(view); _openModal : function(view) {
}, AppLayout.modalRegion.show(view);
},
_closeModal : function() {
AppLayout.modalRegion.closeModal(); _closeModal : function() {
}, AppLayout.modalRegion.closeModal();
},
_openModal2 : function(view) {
AppLayout.modalRegion2.show(view); _openModal2 : function(view) {
}, AppLayout.modalRegion2.show(view);
},
_closeModal2 : function() {
AppLayout.modalRegion2.closeModal(); _closeModal2 : function() {
}, AppLayout.modalRegion2.closeModal();
},
_editSeries : function(options) {
var view = new EditSeriesView({ model : options.series }); _editSeries : function(options) {
AppLayout.modalRegion.show(view); var view = new EditSeriesView({ model : options.series });
}, AppLayout.modalRegion.show(view);
},
_editMovie : function(options) {
var view = new EditMovieView({ model : options.movie }); _editMovie : function(options) {
AppLayout.modalRegion.show(view); var view = new EditMovieView({ model : options.movie });
}, AppLayout.modalRegion.show(view);
},
_deleteSeries : function(options) {
var view = new DeleteSeriesView({ model : options.series }); _editFile : function(options) {
AppLayout.modalRegion.show(view); var view = new EditFileView({ model : options.file });
}, AppLayout.modalRegion.show(view);
},
_showEpisode : function(options) {
var view = new EpisodeDetailsLayout({ _deleteSeries : function(options) {
model : options.episode, var view = new DeleteSeriesView({ model : options.series });
hideSeriesLink : options.hideSeriesLink, AppLayout.modalRegion.show(view);
openingTab : options.openingTab },
});
AppLayout.modalRegion.show(view); _showEpisode : function(options) {
}, var view = new EpisodeDetailsLayout({
model : options.episode,
_showMovie : function(options) { hideSeriesLink : options.hideSeriesLink,
var view = new MoviesDetailsLayout({ openingTab : options.openingTab
model : options.movie, });
hideSeriesLink : options.hideSeriesLink, AppLayout.modalRegion.show(view);
openingTab : options.openingTab },
});
AppLayout.modalRegion.show(view); _showMovie : function(options) {
}, var view = new MoviesDetailsLayout({
model : options.movie,
_showHistory : function(options) { hideSeriesLink : options.hideSeriesLink,
var view = new HistoryDetailsLayout({ model : options.model }); openingTab : options.openingTab
AppLayout.modalRegion.show(view); });
}, AppLayout.modalRegion.show(view);
},
_showLogDetails : function(options) {
var view = new LogDetailsView({ model : options.model }); _showHistory : function(options) {
AppLayout.modalRegion.show(view); var view = new HistoryDetailsLayout({ model : options.model });
}, AppLayout.modalRegion.show(view);
},
_showRenamePreview : function(options) {
var view = new RenamePreviewLayout(options); _showLogDetails : function(options) {
AppLayout.modalRegion.show(view); var view = new LogDetailsView({ model : options.model });
}, AppLayout.modalRegion.show(view);
},
_showManualImport : function(options) {
var view = new ManualImportLayout(options); _showRenamePreview : function(options) {
AppLayout.modalRegion.show(view); var view = new RenamePreviewLayout(options);
}, AppLayout.modalRegion.show(view);
},
_showFileBrowser : function(options) {
var view = new FileBrowserLayout(options); _showManualImport : function(options) {
AppLayout.modalRegion2.show(view); var view = new ManualImportLayout(options);
}, AppLayout.modalRegion.show(view);
},
_closeFileBrowser : function() {
AppLayout.modalRegion2.closeModal(); _showFileBrowser : function(options) {
} var view = new FileBrowserLayout(options);
AppLayout.modalRegion2.show(view);
},
_closeFileBrowser : function() {
AppLayout.modalRegion2.closeModal();
}
}); });

@ -3,40 +3,41 @@ var Wreqr = require('./JsLibraries/backbone.wreqr');
var vent = new Wreqr.EventAggregator(); var vent = new Wreqr.EventAggregator();
vent.Events = { vent.Events = {
SeriesAdded : 'series:added', SeriesAdded : 'series:added',
SeriesDeleted : 'series:deleted', SeriesDeleted : 'series:deleted',
CommandComplete : 'command:complete', CommandComplete : 'command:complete',
ServerUpdated : 'server:updated', ServerUpdated : 'server:updated',
EpisodeFileDeleted : 'episodefile:deleted' EpisodeFileDeleted : 'episodefile:deleted'
}; };
vent.Commands = { vent.Commands = {
EditSeriesCommand : 'EditSeriesCommand', EditSeriesCommand : 'EditSeriesCommand',
EditMovieCommand : 'EditMovieCommand', EditMovieCommand : 'EditMovieCommand',
DeleteSeriesCommand : 'DeleteSeriesCommand', EditFileCommand : "EditFileCommand",
OpenModalCommand : 'OpenModalCommand', DeleteSeriesCommand : 'DeleteSeriesCommand',
CloseModalCommand : 'CloseModalCommand', OpenModalCommand : 'OpenModalCommand',
OpenModal2Command : 'OpenModal2Command', CloseModalCommand : 'CloseModalCommand',
CloseModal2Command : 'CloseModal2Command', OpenModal2Command : 'OpenModal2Command',
ShowEpisodeDetails : 'ShowEpisodeDetails', CloseModal2Command : 'CloseModal2Command',
ShowMovieDetails : 'ShowMovieDetails', ShowEpisodeDetails : 'ShowEpisodeDetails',
ShowHistoryDetails : 'ShowHistoryDetails', ShowMovieDetails : 'ShowMovieDetails',
ShowLogDetails : 'ShowLogDetails', ShowHistoryDetails : 'ShowHistoryDetails',
SaveSettings : 'saveSettings', ShowLogDetails : 'ShowLogDetails',
ShowLogFile : 'showLogFile', SaveSettings : 'saveSettings',
ShowRenamePreview : 'showRenamePreview', ShowLogFile : 'showLogFile',
ShowManualImport : 'showManualImport', ShowRenamePreview : 'showRenamePreview',
ShowFileBrowser : 'showFileBrowser', ShowManualImport : 'showManualImport',
CloseFileBrowser : 'closeFileBrowser', ShowFileBrowser : 'showFileBrowser',
OpenControlPanelCommand : 'OpenControlPanelCommand', CloseFileBrowser : 'closeFileBrowser',
CloseControlPanelCommand : 'CloseControlPanelCommand', OpenControlPanelCommand : 'OpenControlPanelCommand',
ShowExistingCommand : 'ShowExistingCommand' CloseControlPanelCommand : 'CloseControlPanelCommand',
ShowExistingCommand : 'ShowExistingCommand'
}; };
vent.Hotkeys = { vent.Hotkeys = {
NavbarSearch : 'navbar:search', NavbarSearch : 'navbar:search',
SaveSettings : 'settings:save', SaveSettings : 'settings:save',
ShowHotkeys : 'hotkeys:show' ShowHotkeys : 'hotkeys:show'
}; };
module.exports = vent; module.exports = vent;

Loading…
Cancel
Save