Enable automatic renaming, according to naming scheme, of movie folder after creation of the movie. (#1349)

Please test everything you can about this and report back if everything still works correctly.
This commit is contained in:
Leonardo Galli
2017-04-26 13:31:55 +02:00
committed by GitHub
parent f1e8a9acfc
commit 7db92c6bcf
34 changed files with 469 additions and 57 deletions

View File

@@ -47,27 +47,29 @@
</div>
</div>
<!--<div class="form-group">
<label class="col-sm-4 control-label">Use Season Folder</label>
<div class="form-group">
<label class="col-sm-4 control-label">Static Path</label>
<div class="col-sm-8">
<div class="col-sm-6">
<div class="input-group">
<label class="checkbox toggle well">
<input type="checkbox" name="seasonFolder"/>
<input type="checkbox" name="pathState"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<div class="btn btn-primary slide-button"/>
<div class="btn btn-primary slide-button">
</div>
</label>
<span class="help-inline-checkbox">
<i class="icon-sonarr-form-info" title="Should downloaded episodes be stored in season folders?"/>
<i class="icon-sonarr-form-info" title="Should movie path stay static or should it change on each disk scan according to your naming config? Note: Auto Rename Folders under Settings -&gt; Media Management must be enabled too."/>
</span>
</div>
</div>
</div>-->
</div>
<div class="form-group">
<label class="col-sm-4 control-label">Profile</label>

View File

@@ -22,6 +22,12 @@ var view = Marionette.ItemView.extend({
initialize : function() {
this.model.set('profiles', Profiles);
var pathState = this.model.get("pathState");
if (pathState == "static") {
this.model.set("pathState", true);
} else {
this.model.set("pathState", false);
}
},
onRender : function() {
@@ -30,11 +36,18 @@ var view = Marionette.ItemView.extend({
model : this.model,
property : 'tags'
});
},
_onBeforeSave : function() {
var profileId = this.ui.profile.val();
this.model.set({ profileId : profileId });
var pathState = this.model.get("pathState");
if (pathState === true) {
this.model.set("pathState", "static");
} else {
this.model.set("pathState", "dynamic");
}
},
_onAfterSave : function() {

View File

@@ -15,7 +15,7 @@ module.exports = Marionette.ItemView.extend({
monitored : '.x-monitored',
profile : '.x-profiles',
minimumAvailability : '.x-minimumavailability',
seasonFolder : '.x-season-folder',
staticPath : '.x-static-path',
rootFolder : '.x-root-folder',
selectedCount : '.x-selected-count',
container : '.series-editor-footer',
@@ -52,7 +52,7 @@ module.exports = Marionette.ItemView.extend({
this.listenTo(FullMovieCollection, 'save', function() {
window.alert(' Done Saving');
var selected = FullMovieCollection.where({ selected : true });
});
@@ -71,7 +71,7 @@ module.exports = Marionette.ItemView.extend({
var monitored = this.ui.monitored.val();
var minAvail = this.ui.minimumAvailability.val();
var profile = this.ui.profile.val();
var seasonFolder = this.ui.seasonFolder.val();
var staticPath = this.ui.staticPath.val();
var rootFolder = this.ui.rootFolder.val();
var i = 0;
@@ -94,10 +94,8 @@ module.exports = Marionette.ItemView.extend({
model.set('profileId', parseInt(profile, 10));
}
if (seasonFolder === 'true') {
model.set('seasonFolder', true);
} else if (seasonFolder === 'false') {
model.set('seasonFolder', false);
if (staticPath !== 'noChange') {
model.set('pathState', staticPath);
}
if (rootFolder !== 'noChange') {
@@ -129,10 +127,8 @@ module.exports = Marionette.ItemView.extend({
m.set('profileId', parseInt(profile, 10));
}
if (seasonFolder === 'true') {
m.set('seasonFolder', true);
} else if (seasonFolder === 'false') {
m.set('seasonFolder', false);
if (staticPath !== 'noChange') {
m.set('pathState', staticPath);
}
if (rootFolder !== 'noChange') {

View File

@@ -1,6 +1,6 @@
<div class="series-editor-footer">
<div class="row">
<div class="form-group col-md-2">
<div class="form-group col-md-1">
<label>Monitored</label>
<select class="form-control x-action x-monitored">
@@ -33,15 +33,15 @@
</select>
</div>
{{!--<div class="form-group col-md-2">
<label>Season Folder</label>
<div class="form-group col-md-2">
<label>Static Path</label>
<select class="form-control x-action x-season-folder">
<select class="form-control x-action x-static-path">
<option value="noChange">No change</option>
<option value="true">Yes</option>
<option value="false">No</option>
<option value="static">Yes</option>
<option value="dynamic">No</option>
</select>
</div>--}}
</div>
<div class="form-group col-md-3">
<label>Root Folder</label>
@@ -55,7 +55,7 @@
</select>
</div>
<div class="form-group col-md-3 actions">
<div class="form-group col-md-2 actions">
<label class="x-selected-count">0 movies selected</label>
<div>
<button class="btn btn-primary x-action x-save">Save</button>

View File

@@ -165,7 +165,7 @@ module.exports = Marionette.Layout.extend({
onRender : function() {
//this._showToolbar();
//this._showTable();
//this._showPager();
//this._showPager();
//if (window.shownOnce){
// this.movieCollection.fetch();
//}

View File

@@ -48,6 +48,7 @@ var view = Marionette.ItemView.extend({
_onAfterSave : function() {
this.trigger('saved');
vent.trigger(vent.Commands.MovieFileEdited);
vent.trigger(vent.Commands.CloseModalCommand);
},

View File

@@ -87,7 +87,7 @@ module.exports = Marionette.Layout.extend({
}
});
vent.on(vent.Commands.CloseModalCommand, this._refreshClose, this);
vent.on(vent.Commands.MovieFileEdited, this._showGrid, this);
},
_refresh : function(model) {
@@ -105,7 +105,7 @@ module.exports = Marionette.Layout.extend({
this.filesCollection = new FilesCollection();
var file = this.movie.model.get("movieFile");
this.filesCollection.add(file);
this.onShow();
this._showGrid();
},
onShow : function() {
@@ -117,6 +117,15 @@ module.exports = Marionette.Layout.extend({
}));
},
_showGrid : function() {
this.regionManager.get('grid').show(new Backgrid.Grid({
row : Backgrid.Row,
columns : this.columns,
collection : this.filesCollection,
className : 'table table-hover'
}));
},
_showMainView : function() {
this.main.show(this.mainView);
},

View File

@@ -9,6 +9,7 @@ module.exports = Marionette.ItemView.extend({
//var type = this.model.get('seriesType');
return {
rename : this.naming.get('renameEpisodes'),
folderFormat: this.naming.get('movieFolderFormat'),
format : this.naming.get('standardMovieFormat')
};
},

View File

@@ -1,3 +1,4 @@
{{#if rename}}
Folder Naming pattern: {{folderFormat}}<br>
Naming pattern: {{format}}
{{/if}}

View File

@@ -9,7 +9,7 @@
</div>
<div class="modal-body">
<div class="alert alert-info">
<div class="path-info x-path-info">All paths are relative to: <strong>{{path}}</strong></div>
<div class="path-info x-path-info">Your movie may be moved; see the paths below</strong></div>
<div class="x-format-region"></div>
</div>

View File

@@ -162,6 +162,10 @@
<ul class="dropdown-menu">
{{> MovieTitleNamingPartial}}
{{> ReleaseYearNamingPartial}}
{{> QualityNamingPartial}}
{{> MediaInfoNamingPartial}}
{{> ReleaseGroupNamingPartial}}
{{> OriginalTitleNamingPartial}}
{{> ImdbIdNamingPartial}}
</ul>
</div>

View File

@@ -23,6 +23,52 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Automatically Rename Folders</label>
<div class="col-sm-9">
<div class="input-group">
<label class="checkbox toggle well">
<input type="checkbox" name="autoRenameFolders"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<div class="btn btn-primary slide-button"/>
</label>
<span class="help-inline-checkbox">
<i class="icon-sonarr-form-warning" title="CURRENTLY ALPHA! This feature must be enabled for namings schemes beyond '{Movie Title} {Year}' to work. With it folders are automatically renamed according to your naming scheme on each disk scan. If your folder naming scheme contains things such as quality, etc., the movie folder will be automatcially adjusted for that regardless of this setting."/>
</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Movie Paths Default to Static</label>
<div class="col-sm-9">
<div class="input-group">
<label class="checkbox toggle well">
<input type="checkbox" name="pathsDefaultStatic"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<div class="btn btn-primary slide-button"/>
</label>
<span class="help-inline-checkbox">
<i class="icon-sonarr-form-warning" title="CURRENTLY ALPHA! If enabled, the path of new movies is static and won't change."/>
</span>
</div>
</div>
</div>
</fieldset>
<fieldset class="advanced-setting">

View File

@@ -32,7 +32,8 @@ vent.Commands = {
CloseFileBrowser : 'closeFileBrowser',
OpenControlPanelCommand : 'OpenControlPanelCommand',
CloseControlPanelCommand : 'CloseControlPanelCommand',
ShowExistingCommand : 'ShowExistingCommand'
ShowExistingCommand : 'ShowExistingCommand',
MovieFileEdited : 'MovieFileEdited'
};
vent.Hotkeys = {