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