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;
_qualityUpgradableSpecification = qualityUpgradableSpecification;
_logger = logger;
/*GetResourceById = GetEpisodeFile;
GetResourceAll = GetEpisodeFiles;
GetResourceById = GetMovieFile;
/*GetResourceAll = GetEpisodeFiles;
UpdateResource = SetQuality;*/
UpdateResource = SetQuality;
DeleteResource = DeleteEpisodeFile;
}
/*private EpisodeFileResource GetEpisodeFile(int id)
private MovieFileResource GetMovieFile(int id)
{
var episodeFile = _mediaFileService.Get(id);
var series = _seriesService.GetSeries(episodeFile.SeriesId);
var episodeFile = _mediaFileService.GetMovie(id);
return episodeFile.ToResource(series, _qualityUpgradableSpecification);
return episodeFile.ToResource();
}
private List<EpisodeFileResource> GetEpisodeFiles()
/*private List<EpisodeFileResource> GetEpisodeFiles()
{
if (!Request.Query.SeriesId.HasValue)
{
@ -62,13 +62,13 @@ namespace NzbDrone.Api.EpisodeFiles
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;
_mediaFileService.Update(episodeFile);
}*/
}
private void DeleteEpisodeFile(int id)
{

@ -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'
});
}
});

@ -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 EditionCell = require('../../Cells/EditionCell');
var DeleteFileCell = require("./DeleteFileCell");
var EditFileCell = require("./EditFileCell");
module.exports = Marionette.Layout.extend({
template : 'Movies/Files/FilesLayoutTemplate',
template : 'Movies/Files/FilesLayoutTemplate',
regions : {
main : '#movie-files-region',
grid : "#movie-files-grid"
},
regions : {
main : '#movie-files-region',
grid : "#movie-files-grid"
},
events : {
'click .x-search-auto' : '_searchAuto',
'click .x-search-manual' : '_searchManual',
'click .x-search-back' : '_showButtons'
},
events : {
'click .x-search-auto' : '_searchAuto',
'click .x-search-manual' : '_searchManual',
'click .x-search-back' : '_showButtons'
},
columns : [
{
name : 'title',
label : 'Title',
cell : FileTitleCell
},
{
name : "mediaInfo",
label : "Media Info",
cell : MediaInfoCell
},
{
name : 'edition',
label : 'Edition',
cell : EditionCell,
title : "Edition",
},
{
name : 'size',
label : 'Size',
cell : FileSizeCell
},
{
name : 'quality',
label : 'Quality',
cell : QualityCell,
},
{
name : "delete",
label : "",
cell : DeleteFileCell,
}
],
columns : [
{
name : 'title',
label : 'Title',
cell : FileTitleCell
},
{
name : "mediaInfo",
label : "Media Info",
cell : MediaInfoCell
},
{
name : 'edition',
label : 'Edition',
cell : EditionCell,
title : "Edition",
},
{
name : 'size',
label : 'Size',
cell : FileSizeCell
},
{
name : 'quality',
label : 'Quality',
cell : QualityCell,
},
{
name : "delete",
label : "",
cell : DeleteFileCell,
},
{
name : "edit",
label : "",
cell : EditFileCell,
}
],
initialize : function(movie) {
this.filesCollection = new FilesCollection();
var file = movie.model.get("movieFile");
this.filesCollection.add(file);
//this.listenTo(this.releaseCollection, 'sync', this._showSearchResults);
},
initialize : function(movie) {
this.filesCollection = new FilesCollection();
var file = movie.model.get("movieFile");
this.movie = movie;
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() {
this.grid.show(new Backgrid.Grid({
row : Backgrid.Row,
columns : this.columns,
collection : this.filesCollection,
className : 'table table-hover'
}));
},
vent.on(vent.Commands.CloseModalCommand, this._refreshClose, this);
},
_showMainView : function() {
this.main.show(this.mainView);
},
_refresh : function(movie) {
this.filesCollection = new FilesCollection();
var file = movie.model.get("movieFile");
this.filesCollection.add(file);
this.onShow();
},
_showButtons : function() {
this._showMainView();
},
_refreshClose : function(options) {
this.filesCollection = new FilesCollection();
var file = this.movie.model.get("movieFile");
this.filesCollection.add(file);
this.onShow();
},
_showSearchResults : function() {
if (this.releaseCollection.length === 0) {
this.mainView = new NoResultsView();
}
onShow : function() {
this.grid.show(new Backgrid.Grid({
row : Backgrid.Row,
columns : this.columns,
collection : this.filesCollection,
className : 'table table-hover'
}));
},
else {
//this.mainView = new ManualSearchLayout({ collection : this.releaseCollection });
}
_showMainView : function() {
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 FileBrowserLayout = require('../FileBrowser/FileBrowserLayout');
var MoviesDetailsLayout = require('../../Movies/Details/MoviesDetailsLayout');
var EditFileView = require("../../Movies/Files/Edit/EditFileView");
module.exports = Marionette.AppRouter.extend({
initialize : function() {
vent.on(vent.Commands.OpenModalCommand, this._openModal, this);
vent.on(vent.Commands.CloseModalCommand, this._closeModal, this);
vent.on(vent.Commands.OpenModal2Command, this._openModal2, this);
vent.on(vent.Commands.CloseModal2Command, this._closeModal2, this);
vent.on(vent.Commands.EditSeriesCommand, this._editSeries, this);
vent.on(vent.Commands.EditMovieCommand, this._editMovie, this);
vent.on(vent.Commands.DeleteSeriesCommand, this._deleteSeries, this);
vent.on(vent.Commands.ShowEpisodeDetails, this._showEpisode, this);
vent.on(vent.Commands.ShowMovieDetails, this._showMovie, this);
vent.on(vent.Commands.ShowHistoryDetails, this._showHistory, this);
vent.on(vent.Commands.ShowLogDetails, this._showLogDetails, this);
vent.on(vent.Commands.ShowRenamePreview, this._showRenamePreview, this);
vent.on(vent.Commands.ShowManualImport, this._showManualImport, this);
vent.on(vent.Commands.ShowFileBrowser, this._showFileBrowser, this);
vent.on(vent.Commands.CloseFileBrowser, this._closeFileBrowser, this);
},
_openModal : function(view) {
AppLayout.modalRegion.show(view);
},
_closeModal : function() {
AppLayout.modalRegion.closeModal();
},
_openModal2 : function(view) {
AppLayout.modalRegion2.show(view);
},
_closeModal2 : function() {
AppLayout.modalRegion2.closeModal();
},
_editSeries : function(options) {
var view = new EditSeriesView({ model : options.series });
AppLayout.modalRegion.show(view);
},
_editMovie : function(options) {
var view = new EditMovieView({ model : options.movie });
AppLayout.modalRegion.show(view);
},
_deleteSeries : function(options) {
var view = new DeleteSeriesView({ model : options.series });
AppLayout.modalRegion.show(view);
},
_showEpisode : function(options) {
var view = new EpisodeDetailsLayout({
model : options.episode,
hideSeriesLink : options.hideSeriesLink,
openingTab : options.openingTab
});
AppLayout.modalRegion.show(view);
},
_showMovie : function(options) {
var view = new MoviesDetailsLayout({
model : options.movie,
hideSeriesLink : options.hideSeriesLink,
openingTab : options.openingTab
});
AppLayout.modalRegion.show(view);
},
_showHistory : function(options) {
var view = new HistoryDetailsLayout({ model : options.model });
AppLayout.modalRegion.show(view);
},
_showLogDetails : function(options) {
var view = new LogDetailsView({ model : options.model });
AppLayout.modalRegion.show(view);
},
_showRenamePreview : function(options) {
var view = new RenamePreviewLayout(options);
AppLayout.modalRegion.show(view);
},
_showManualImport : function(options) {
var view = new ManualImportLayout(options);
AppLayout.modalRegion.show(view);
},
_showFileBrowser : function(options) {
var view = new FileBrowserLayout(options);
AppLayout.modalRegion2.show(view);
},
_closeFileBrowser : function() {
AppLayout.modalRegion2.closeModal();
}
initialize : function() {
vent.on(vent.Commands.OpenModalCommand, this._openModal, this);
vent.on(vent.Commands.CloseModalCommand, this._closeModal, this);
vent.on(vent.Commands.OpenModal2Command, this._openModal2, this);
vent.on(vent.Commands.CloseModal2Command, this._closeModal2, this);
vent.on(vent.Commands.EditSeriesCommand, this._editSeries, this);
vent.on(vent.Commands.EditMovieCommand, this._editMovie, this);
vent.on(vent.Commands.EditFileCommand, this._editFile, this);
vent.on(vent.Commands.DeleteSeriesCommand, this._deleteSeries, this);
vent.on(vent.Commands.ShowEpisodeDetails, this._showEpisode, this);
vent.on(vent.Commands.ShowMovieDetails, this._showMovie, this);
vent.on(vent.Commands.ShowHistoryDetails, this._showHistory, this);
vent.on(vent.Commands.ShowLogDetails, this._showLogDetails, this);
vent.on(vent.Commands.ShowRenamePreview, this._showRenamePreview, this);
vent.on(vent.Commands.ShowManualImport, this._showManualImport, this);
vent.on(vent.Commands.ShowFileBrowser, this._showFileBrowser, this);
vent.on(vent.Commands.CloseFileBrowser, this._closeFileBrowser, this);
},
_openModal : function(view) {
AppLayout.modalRegion.show(view);
},
_closeModal : function() {
AppLayout.modalRegion.closeModal();
},
_openModal2 : function(view) {
AppLayout.modalRegion2.show(view);
},
_closeModal2 : function() {
AppLayout.modalRegion2.closeModal();
},
_editSeries : function(options) {
var view = new EditSeriesView({ model : options.series });
AppLayout.modalRegion.show(view);
},
_editMovie : function(options) {
var view = new EditMovieView({ model : options.movie });
AppLayout.modalRegion.show(view);
},
_editFile : function(options) {
var view = new EditFileView({ model : options.file });
AppLayout.modalRegion.show(view);
},
_deleteSeries : function(options) {
var view = new DeleteSeriesView({ model : options.series });
AppLayout.modalRegion.show(view);
},
_showEpisode : function(options) {
var view = new EpisodeDetailsLayout({
model : options.episode,
hideSeriesLink : options.hideSeriesLink,
openingTab : options.openingTab
});
AppLayout.modalRegion.show(view);
},
_showMovie : function(options) {
var view = new MoviesDetailsLayout({
model : options.movie,
hideSeriesLink : options.hideSeriesLink,
openingTab : options.openingTab
});
AppLayout.modalRegion.show(view);
},
_showHistory : function(options) {
var view = new HistoryDetailsLayout({ model : options.model });
AppLayout.modalRegion.show(view);
},
_showLogDetails : function(options) {
var view = new LogDetailsView({ model : options.model });
AppLayout.modalRegion.show(view);
},
_showRenamePreview : function(options) {
var view = new RenamePreviewLayout(options);
AppLayout.modalRegion.show(view);
},
_showManualImport : function(options) {
var view = new ManualImportLayout(options);
AppLayout.modalRegion.show(view);
},
_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();
vent.Events = {
SeriesAdded : 'series:added',
SeriesDeleted : 'series:deleted',
CommandComplete : 'command:complete',
ServerUpdated : 'server:updated',
EpisodeFileDeleted : 'episodefile:deleted'
SeriesAdded : 'series:added',
SeriesDeleted : 'series:deleted',
CommandComplete : 'command:complete',
ServerUpdated : 'server:updated',
EpisodeFileDeleted : 'episodefile:deleted'
};
vent.Commands = {
EditSeriesCommand : 'EditSeriesCommand',
EditMovieCommand : 'EditMovieCommand',
DeleteSeriesCommand : 'DeleteSeriesCommand',
OpenModalCommand : 'OpenModalCommand',
CloseModalCommand : 'CloseModalCommand',
OpenModal2Command : 'OpenModal2Command',
CloseModal2Command : 'CloseModal2Command',
ShowEpisodeDetails : 'ShowEpisodeDetails',
ShowMovieDetails : 'ShowMovieDetails',
ShowHistoryDetails : 'ShowHistoryDetails',
ShowLogDetails : 'ShowLogDetails',
SaveSettings : 'saveSettings',
ShowLogFile : 'showLogFile',
ShowRenamePreview : 'showRenamePreview',
ShowManualImport : 'showManualImport',
ShowFileBrowser : 'showFileBrowser',
CloseFileBrowser : 'closeFileBrowser',
OpenControlPanelCommand : 'OpenControlPanelCommand',
CloseControlPanelCommand : 'CloseControlPanelCommand',
ShowExistingCommand : 'ShowExistingCommand'
EditSeriesCommand : 'EditSeriesCommand',
EditMovieCommand : 'EditMovieCommand',
EditFileCommand : "EditFileCommand",
DeleteSeriesCommand : 'DeleteSeriesCommand',
OpenModalCommand : 'OpenModalCommand',
CloseModalCommand : 'CloseModalCommand',
OpenModal2Command : 'OpenModal2Command',
CloseModal2Command : 'CloseModal2Command',
ShowEpisodeDetails : 'ShowEpisodeDetails',
ShowMovieDetails : 'ShowMovieDetails',
ShowHistoryDetails : 'ShowHistoryDetails',
ShowLogDetails : 'ShowLogDetails',
SaveSettings : 'saveSettings',
ShowLogFile : 'showLogFile',
ShowRenamePreview : 'showRenamePreview',
ShowManualImport : 'showManualImport',
ShowFileBrowser : 'showFileBrowser',
CloseFileBrowser : 'closeFileBrowser',
OpenControlPanelCommand : 'OpenControlPanelCommand',
CloseControlPanelCommand : 'CloseControlPanelCommand',
ShowExistingCommand : 'ShowExistingCommand'
};
vent.Hotkeys = {
NavbarSearch : 'navbar:search',
SaveSettings : 'settings:save',
ShowHotkeys : 'hotkeys:show'
NavbarSearch : 'navbar:search',
SaveSettings : 'settings:save',
ShowHotkeys : 'hotkeys:show'
};
module.exports = vent;

Loading…
Cancel
Save