parent
bb37444a99
commit
e42ac25657
@ -1,24 +0,0 @@
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles.Commands
|
||||
{
|
||||
public class RenameSeasonCommand : Command
|
||||
{
|
||||
public int SeriesId { get; set; }
|
||||
public int SeasonNumber { get; set; }
|
||||
|
||||
public override bool SendUpdatesToClient
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public RenameSeasonCommand(int seriesId, int seasonNumber)
|
||||
{
|
||||
SeriesId = seriesId;
|
||||
SeasonNumber = seasonNumber;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
C:\Dropbox\Dev\NzbDrone\_output\ServiceInstall.exe.config
|
||||
C:\Dropbox\Dev\NzbDrone\_output\ServiceInstall.exe
|
||||
C:\Dropbox\Dev\NzbDrone\_output\ServiceInstall.pdb
|
||||
C:\Dropbox\Dev\NzbDrone\src\ServiceHelpers\ServiceInstall\obj\x86\Debug\ServiceInstall.csprojResolveAssemblyReference.cache
|
||||
C:\Dropbox\Dev\NzbDrone\src\ServiceHelpers\ServiceInstall\obj\x86\Debug\ServiceInstall.exe
|
||||
C:\Dropbox\Dev\NzbDrone\src\ServiceHelpers\ServiceInstall\obj\x86\Debug\ServiceInstall.pdb
|
Binary file not shown.
@ -0,0 +1,5 @@
|
||||
C:\Dropbox\Dev\NzbDrone\_output\ServiceUninstall.exe.config
|
||||
C:\Dropbox\Dev\NzbDrone\_output\ServiceUninstall.exe
|
||||
C:\Dropbox\Dev\NzbDrone\_output\ServiceUninstall.pdb
|
||||
C:\Dropbox\Dev\NzbDrone\src\ServiceHelpers\ServiceUninstall\obj\x86\Debug\ServiceUninstall.exe
|
||||
C:\Dropbox\Dev\NzbDrone\src\ServiceHelpers\ServiceUninstall\obj\x86\Debug\ServiceUninstall.pdb
|
Binary file not shown.
@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Rename/RenamePreviewItemView'
|
||||
], function (Marionette, RenamePreviewItemView) {
|
||||
return Marionette.CollectionView.extend({
|
||||
|
||||
itemView : RenamePreviewItemView
|
||||
});
|
||||
});
|
@ -0,0 +1,93 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'underscore',
|
||||
'vent',
|
||||
'marionette',
|
||||
'Rename/RenamePreviewCollection',
|
||||
'Rename/RenamePreviewCollectionView',
|
||||
'Rename/RenamePreviewEmptyCollectionView',
|
||||
'Shared/LoadingView',
|
||||
'Commands/CommandController'
|
||||
], function (_, vent, Marionette, RenamePreviewCollection, RenamePreviewCollectionView, EmptyCollectionView, LoadingView, CommandController) {
|
||||
|
||||
return Marionette.Layout.extend({
|
||||
template: 'Rename/RenamePreviewLayoutTemplate',
|
||||
|
||||
regions: {
|
||||
renamePreviews : '#rename-previews'
|
||||
},
|
||||
|
||||
ui: {
|
||||
pathInfo: '.x-path-info'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-organize': '_organizeFiles'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.model = options.series;
|
||||
this.seasonNumber = options.seasonNumber;
|
||||
|
||||
var viewOptions = {};
|
||||
viewOptions.seriesId = this.model.id;
|
||||
viewOptions.seasonNumber = this.seasonNumber;
|
||||
|
||||
this.collection = new RenamePreviewCollection(viewOptions);
|
||||
this.listenTo(this.collection, 'sync', this._showPreviews);
|
||||
|
||||
this.collection.fetch();
|
||||
},
|
||||
|
||||
onRender: function() {
|
||||
this.renamePreviews.show(new LoadingView());
|
||||
},
|
||||
|
||||
_showPreviews: function () {
|
||||
if (this.collection.length === 0) {
|
||||
this.ui.pathInfo.hide();
|
||||
this.renamePreviews.show(new EmptyCollectionView());
|
||||
return;
|
||||
}
|
||||
|
||||
this.collection.invoke('set', { rename: true });
|
||||
this.renamePreviews.show(new RenamePreviewCollectionView({ collection: this.collection }));
|
||||
},
|
||||
|
||||
_organizeFiles: function () {
|
||||
if (this.collection.length === 0) {
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
}
|
||||
|
||||
var files = _.map(this.collection.where({ rename: true }), function (model) {
|
||||
return model.get('episodeFileId');
|
||||
});
|
||||
|
||||
if (files.length === 0) {
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.seasonNumber) {
|
||||
CommandController.Execute('renameFiles', {
|
||||
name : 'renameFiles',
|
||||
seriesId : this.model.id,
|
||||
seasonNumber: this.seasonNumber,
|
||||
files : files
|
||||
});
|
||||
}
|
||||
|
||||
else {
|
||||
CommandController.Execute('renameFiles', {
|
||||
name : 'renameFiles',
|
||||
seriesId : this.model.id,
|
||||
seasonNumber: -1,
|
||||
files : files
|
||||
});
|
||||
}
|
||||
|
||||
vent.trigger(vent.Commands.CloseModalCommand);
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Reference in new issue