mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 04:22:30 +01:00
Cleanup!
This commit is contained in:
parent
7a5cee5b8e
commit
9d94c4490f
@ -26,14 +26,21 @@ private void ConvertConfig(IDbConnection conn, IDbTransaction tran)
|
|||||||
namingConfigCmd.CommandText = @"SELECT * FROM NamingConfig LIMIT 1";
|
namingConfigCmd.CommandText = @"SELECT * FROM NamingConfig LIMIT 1";
|
||||||
using (IDataReader namingConfigReader = namingConfigCmd.ExecuteReader())
|
using (IDataReader namingConfigReader = namingConfigCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
var separatorIndex = namingConfigReader.GetOrdinal("Separator");
|
||||||
|
var numberStyleIndex = namingConfigReader.GetOrdinal("NumberStyle");
|
||||||
|
var includeSeriesTitleIndex = namingConfigReader.GetOrdinal("IncludeSeriesTitle");
|
||||||
|
var includeEpisodeTitleIndex = namingConfigReader.GetOrdinal("IncludeEpisodeTitle");
|
||||||
|
var includeQualityIndex = namingConfigReader.GetOrdinal("IncludeQuality");
|
||||||
|
var replaceSpacesIndex = namingConfigReader.GetOrdinal("ReplaceSpaces");
|
||||||
|
|
||||||
while (namingConfigReader.Read())
|
while (namingConfigReader.Read())
|
||||||
{
|
{
|
||||||
var separator = namingConfigReader.GetString(1);
|
var separator = namingConfigReader.GetString(separatorIndex);
|
||||||
var numberStyle = namingConfigReader.GetInt32(2);
|
var numberStyle = namingConfigReader.GetInt32(numberStyleIndex);
|
||||||
var includeSeriesTitle = namingConfigReader.GetBoolean(3);
|
var includeSeriesTitle = namingConfigReader.GetBoolean(includeSeriesTitleIndex);
|
||||||
var includeEpisodeTitle = namingConfigReader.GetBoolean(5);
|
var includeEpisodeTitle = namingConfigReader.GetBoolean(includeEpisodeTitleIndex);
|
||||||
var includeQuality = namingConfigReader.GetBoolean(6);
|
var includeQuality = namingConfigReader.GetBoolean(includeQualityIndex);
|
||||||
var replaceSpaces = namingConfigReader.GetBoolean(7);
|
var replaceSpaces = namingConfigReader.GetBoolean(replaceSpacesIndex);
|
||||||
|
|
||||||
//Output settings
|
//Output settings
|
||||||
var seriesTitlePattern = "";
|
var seriesTitlePattern = "";
|
||||||
@ -43,21 +50,31 @@ private void ConvertConfig(IDbConnection conn, IDbTransaction tran)
|
|||||||
|
|
||||||
if (includeSeriesTitle)
|
if (includeSeriesTitle)
|
||||||
{
|
{
|
||||||
seriesTitlePattern = "{Series Title}" + separator;
|
|
||||||
|
|
||||||
if (replaceSpaces)
|
if (replaceSpaces)
|
||||||
{
|
{
|
||||||
seriesTitlePattern = "{Series.Title}" + separator;
|
seriesTitlePattern = "{Series.Title}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
seriesTitlePattern = "{Series Title}";
|
||||||
|
}
|
||||||
|
|
||||||
|
seriesTitlePattern += separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeEpisodeTitle)
|
if (includeEpisodeTitle)
|
||||||
{
|
{
|
||||||
episodeTitlePattern = separator + "{Episode Title}";
|
episodeTitlePattern = separator;
|
||||||
|
|
||||||
if (replaceSpaces)
|
if (replaceSpaces)
|
||||||
{
|
{
|
||||||
episodeTitlePattern = separator + "{Episode.Title}";
|
episodeTitlePattern += "{Episode.Title}";
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
episodeTitlePattern += "{Episode Title}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,11 @@ private void ConvertConfig(IDbConnection conn, IDbTransaction tran)
|
|||||||
namingConfigCmd.CommandText = @"SELECT * FROM Config WHERE [Key] = 'seasonfolderformat'";
|
namingConfigCmd.CommandText = @"SELECT * FROM Config WHERE [Key] = 'seasonfolderformat'";
|
||||||
using (IDataReader namingConfigReader = namingConfigCmd.ExecuteReader())
|
using (IDataReader namingConfigReader = namingConfigCmd.ExecuteReader())
|
||||||
{
|
{
|
||||||
|
var valueIndex = namingConfigReader.GetOrdinal("[Value]");
|
||||||
|
|
||||||
while (namingConfigReader.Read())
|
while (namingConfigReader.Read())
|
||||||
{
|
{
|
||||||
var value = namingConfigReader.GetString(2);
|
var value = namingConfigReader.GetString(valueIndex);
|
||||||
|
|
||||||
value = value.Replace("%sn", "{Series Title}")
|
value = value.Replace("%sn", "{Series Title}")
|
||||||
.Replace("%s.n", "{Series.Title}")
|
.Replace("%s.n", "{Series.Title}")
|
||||||
|
@ -12,8 +12,8 @@ public static NamingConfig Default
|
|||||||
{
|
{
|
||||||
RenameEpisodes = false,
|
RenameEpisodes = false,
|
||||||
MultiEpisodeStyle = 0,
|
MultiEpisodeStyle = 0,
|
||||||
StandardEpisodeFormat = "",
|
StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title} {Quality Title}",
|
||||||
DailyEpisodeFormat = ""
|
DailyEpisodeFormat = "{Series Title} - {Air-Date} - {Episode Title} {Quality Title}"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
define(
|
define(
|
||||||
[
|
[
|
||||||
'jquery',
|
|
||||||
'vent',
|
'vent',
|
||||||
'marionette',
|
'marionette',
|
||||||
'Settings/MediaManagement/Naming/NamingSampleModel',
|
'Settings/MediaManagement/Naming/NamingSampleModel',
|
||||||
|
'Settings/MediaManagement/Naming/Wizard/NamingWizardView',
|
||||||
'Mixins/AsModelBoundView',
|
'Mixins/AsModelBoundView',
|
||||||
'Mixins/AsValidatedView'
|
'Mixins/AsValidatedView'
|
||||||
], function ($, vent, Marionette, NamingSampleModel, AsModelBoundView, AsValidatedView) {
|
], function (vent, Marionette, NamingSampleModel, NamingWizardView, AsModelBoundView, AsValidatedView) {
|
||||||
|
|
||||||
var view = Marionette.ItemView.extend({
|
var view = Marionette.ItemView.extend({
|
||||||
template: 'Settings/MediaManagement/Naming/NamingViewTemplate',
|
template: 'Settings/MediaManagement/Naming/NamingViewTemplate',
|
||||||
@ -28,7 +28,7 @@ define(
|
|||||||
},
|
},
|
||||||
|
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
if (!this.model.get('renameEpisodes')) {
|
if (!this.model.has('renameEpisodes')) {
|
||||||
this.ui.namingOptions.hide();
|
this.ui.namingOptions.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,6 +61,10 @@ define(
|
|||||||
},
|
},
|
||||||
|
|
||||||
_showWizard: function () {
|
_showWizard: function () {
|
||||||
|
var modalView = new NamingWizardView();
|
||||||
|
vent.trigger(vent.Commands.OpenModalCommand, modalView);
|
||||||
|
this.listenTo(modalView, modalView.formatsUpdated, this._updateFormats);
|
||||||
|
|
||||||
vent.trigger(vent.Commands.ShowNamingWizard, { model: this.model });
|
vent.trigger(vent.Commands.ShowNamingWizard, { model: this.model });
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -70,20 +74,26 @@ define(
|
|||||||
|
|
||||||
var target = e.target;
|
var target = e.target;
|
||||||
var token = '';
|
var token = '';
|
||||||
var input = $(target).closest('.x-helper-input').children('input');
|
var input = this.$(target).closest('.x-helper-input').children('input');
|
||||||
|
|
||||||
if ($(target).attr('data-token')) {
|
if (this.$(target).attr('data-token')) {
|
||||||
token = '{{0}}'.format($(target).attr('data-token'));
|
token = '{{0}}'.format(this.$(target).attr('data-token'));
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
token = $(target).attr('data-separator');
|
token = this.$(target).attr('data-separator');
|
||||||
}
|
}
|
||||||
|
|
||||||
input.val(input.val() + token);
|
input.val(input.val() + token);
|
||||||
|
|
||||||
this.ui.namingTokenHelper.removeClass('open');
|
this.ui.namingTokenHelper.removeClass('open');
|
||||||
input.focus();
|
input.focus();
|
||||||
|
},
|
||||||
|
|
||||||
|
_updateFormats: function (options) {
|
||||||
|
this.model.set('standardEpisodeFormat', options.standardEpisodeFormat);
|
||||||
|
this.model.set('dailyEpisodeFormat', options.dailyEpisodeFormat);
|
||||||
|
this.model.set('multiEpisodeStyle', options.multiEpisodeStyle);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ define(
|
|||||||
includeQuality : true,
|
includeQuality : true,
|
||||||
replaceSpaces : false,
|
replaceSpaces : false,
|
||||||
separator : ' - ',
|
separator : ' - ',
|
||||||
numberStyle : '2',
|
numberStyle : 'S{season:00}E{episode:00}',
|
||||||
multiEpisodeStyle : 0
|
multiEpisodeStyle : 0
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -22,17 +22,14 @@ define(
|
|||||||
'click .x-apply': '_applyNaming'
|
'click .x-apply': '_applyNaming'
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function (options) {
|
formatsUpdated: 'formatsUpdated',
|
||||||
|
|
||||||
|
initialize: function () {
|
||||||
this.model = new NamingWizardModel();
|
this.model = new NamingWizardModel();
|
||||||
this.namingModel = options.model;
|
|
||||||
this.namingSampleModel = new NamingSampleModel();
|
this.namingSampleModel = new NamingSampleModel();
|
||||||
},
|
},
|
||||||
|
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
if (!this.model.get('renameEpisodes')) {
|
|
||||||
this.ui.namingOptions.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.listenTo(this.model, 'change', this._buildFormat);
|
this.listenTo(this.model, 'change', this._buildFormat);
|
||||||
this.listenTo(this.namingSampleModel, 'sync', this._showSamples);
|
this.listenTo(this.namingSampleModel, 'sync', this._showSamples);
|
||||||
this._buildFormat();
|
this._buildFormat();
|
||||||
@ -56,9 +53,14 @@ define(
|
|||||||
},
|
},
|
||||||
|
|
||||||
_applyNaming: function () {
|
_applyNaming: function () {
|
||||||
this.namingModel.set('standardEpisodeFormat', this.standardEpisodeFormat);
|
var options = {
|
||||||
this.namingModel.set('dailyEpisodeFormat', this.dailyEpisodeFormat);
|
standardEpisodeFormat: this.standardEpisodeFormat,
|
||||||
this.namingModel.set('multiEpisodeStyle', this.model.get('multiEpisodeStyle'));
|
dailyEpisodeFormat: this.dailyEpisodeFormat,
|
||||||
|
multiEpisodeStyle: this.model.get('multiEpisodeStyle')
|
||||||
|
};
|
||||||
|
|
||||||
|
this.trigger(this.formatsUpdated, options);
|
||||||
|
|
||||||
|
|
||||||
vent.trigger(vent.Commands.CloseModalCommand);
|
vent.trigger(vent.Commands.CloseModalCommand);
|
||||||
},
|
},
|
||||||
@ -82,23 +84,7 @@ define(
|
|||||||
this.dailyEpisodeFormat += this.model.get('separator');
|
this.dailyEpisodeFormat += this.model.get('separator');
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (this.model.get('numberStyle')) {
|
this.standardEpisodeFormat += this.model.get('numberStyle');
|
||||||
case '0':
|
|
||||||
this.standardEpisodeFormat += '{season}x{episode:00}';
|
|
||||||
break;
|
|
||||||
case '1':
|
|
||||||
this.standardEpisodeFormat += '{season:00}x{episode:00}';
|
|
||||||
break;
|
|
||||||
case '2':
|
|
||||||
this.standardEpisodeFormat += 'S{season:00}E{episode:00}';
|
|
||||||
break;
|
|
||||||
case '3':
|
|
||||||
this.standardEpisodeFormat += 's{season:00}e{episode:00}';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
this.standardEpisodeFormat += 'Unknown Number Pattern';
|
|
||||||
}
|
|
||||||
|
|
||||||
this.dailyEpisodeFormat += '{Air-Date}';
|
this.dailyEpisodeFormat += '{Air-Date}';
|
||||||
|
|
||||||
if (this.model.get('includeEpisodeTitle')) {
|
if (this.model.get('includeEpisodeTitle')) {
|
||||||
|
@ -89,10 +89,10 @@
|
|||||||
|
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<select class="inputClass" name="numberStyle">
|
<select class="inputClass" name="numberStyle">
|
||||||
<option value="0">1x05</option>
|
<option value="{season}x{episode:00}">1x05</option>
|
||||||
<option value="1">01x05</option>
|
<option value="{season:00}x{episode:00}">01x05</option>
|
||||||
<option value="2">S01E05</option>
|
<option value="S{season:00}E{episode:00}">S01E05</option>
|
||||||
<option value="3">s01e05</option>
|
<option value="s{season:00}e{episode:00}">s01e05</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,19 +9,22 @@ define(
|
|||||||
'Episode/EpisodeDetailsLayout',
|
'Episode/EpisodeDetailsLayout',
|
||||||
'History/Details/HistoryDetailsView',
|
'History/Details/HistoryDetailsView',
|
||||||
'System/Logs/Table/Details/LogDetailsView',
|
'System/Logs/Table/Details/LogDetailsView',
|
||||||
'Settings/MediaManagement/Naming/Wizard/NamingWizardView'
|
], function (vent, AppLayout, Marionette, EditSeriesView, DeleteSeriesView, EpisodeDetailsLayout, HistoryDetailsView, LogDetailsView) {
|
||||||
], function (vent, AppLayout, Marionette, EditSeriesView, DeleteSeriesView, EpisodeDetailsLayout, HistoryDetailsView, LogDetailsView, NamingWizardView) {
|
|
||||||
|
|
||||||
return Marionette.AppRouter.extend({
|
return Marionette.AppRouter.extend({
|
||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
|
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.EditSeriesCommand, this._editSeries, this);
|
vent.on(vent.Commands.EditSeriesCommand, this._editSeries, this);
|
||||||
vent.on(vent.Commands.DeleteSeriesCommand, this._deleteSeries, this);
|
vent.on(vent.Commands.DeleteSeriesCommand, this._deleteSeries, this);
|
||||||
vent.on(vent.Commands.ShowEpisodeDetails, this._showEpisode, this);
|
vent.on(vent.Commands.ShowEpisodeDetails, this._showEpisode, this);
|
||||||
vent.on(vent.Commands.ShowHistoryDetails, this._showHistory, this);
|
vent.on(vent.Commands.ShowHistoryDetails, this._showHistory, this);
|
||||||
vent.on(vent.Commands.ShowLogDetails, this._showLogDetails, this);
|
vent.on(vent.Commands.ShowLogDetails, this._showLogDetails, this);
|
||||||
vent.on(vent.Commands.ShowNamingWizard, this._showNamingWizard, this);
|
},
|
||||||
|
|
||||||
|
_openModal: function (view) {
|
||||||
|
AppLayout.modalRegion.show(view);
|
||||||
},
|
},
|
||||||
|
|
||||||
_closeModal: function () {
|
_closeModal: function () {
|
||||||
@ -51,11 +54,6 @@ define(
|
|||||||
_showLogDetails: function (options) {
|
_showLogDetails: function (options) {
|
||||||
var view = new LogDetailsView({ model: options.model });
|
var view = new LogDetailsView({ model: options.model });
|
||||||
AppLayout.modalRegion.show(view);
|
AppLayout.modalRegion.show(view);
|
||||||
},
|
|
||||||
|
|
||||||
_showNamingWizard: function (options) {
|
|
||||||
var view = new NamingWizardView({ model: options.model });
|
|
||||||
AppLayout.modalRegion.show(view);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -18,6 +18,7 @@ define(
|
|||||||
vent.Commands = {
|
vent.Commands = {
|
||||||
EditSeriesCommand : 'EditSeriesCommand',
|
EditSeriesCommand : 'EditSeriesCommand',
|
||||||
DeleteSeriesCommand: 'DeleteSeriesCommand',
|
DeleteSeriesCommand: 'DeleteSeriesCommand',
|
||||||
|
OpenModalCommand : 'OpenModalCommand',
|
||||||
CloseModalCommand : 'CloseModalCommand',
|
CloseModalCommand : 'CloseModalCommand',
|
||||||
ShowEpisodeDetails : 'ShowEpisodeDetails',
|
ShowEpisodeDetails : 'ShowEpisodeDetails',
|
||||||
ShowHistoryDetails : 'ShowHistoryDetails',
|
ShowHistoryDetails : 'ShowHistoryDetails',
|
||||||
|
Loading…
Reference in New Issue
Block a user