The Free Software Media System - Server Backend & API
use constructor to set optimal config values
dkanada83ae4d074dc9
diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.csindex 8fb9520d6d..ac2edc1e2e 100644--- a/Emby.Server.Implementations/Collections/CollectionManager.cs+++ b/Emby.Server.Implementations/Collections/CollectionManager.cs@@ -363,60 +363,4 @@ namespace Emby.Server.Implementations.Collectionsreturn results.Values;}}-- /// <summary>- /// The collection manager entry point.- /// </summary>- public sealed class CollectionManagerEntryPoint : IServerEntryPoint- {- private readonly CollectionManager _collectionManager;- private readonly IServerConfigurationManager _config;- private readonly ILogger<CollectionManagerEntryPoint> _logger;-- /// <summary>- /// Initializes a new instance of the <see cref="CollectionManagerEntryPoint"/> class.- /// </summary>- /// <param name="collectionManager">The collection manager.</param>- /// <param name="config">The server configuration manager.</param>- /// <param name="logger">The logger.</param>- public CollectionManagerEntryPoint(- ICollectionManager collectionManager,- IServerConfigurationManager config,- ILogger<CollectionManagerEntryPoint> logger)- {- _collectionManager = (CollectionManager)collectionManager;- _config = config;- _logger = logger;- }-- /// <inheritdoc />- public async Task RunAsync()- {- if (!_config.Configuration.CollectionsUpgraded && _config.Configuration.IsStartupWizardCompleted)- {- var path = _collectionManager.GetCollectionsFolderPath();-- if (Directory.Exists(path))- {- try- {- await _collectionManager.EnsureLibraryFolder(path, true).ConfigureAwait(false);- }- catch (Exception ex)- {- _logger.LogError(ex, "Error creating camera uploads library");- }-- _config.Configuration.CollectionsUpgraded = true;- _config.SaveConfiguration();- }- }- }-- /// <inheritdoc />- public void Dispose()- {- // Nothing to dispose- }- }}diff --git a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.csindex 94ee1ced71..a15295fca4 100644--- a/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs+++ b/Emby.Server.Implementations/Configuration/ServerConfigurationManager.cs@@ -109,7 +109,6 @@ namespace Emby.Server.Implementations.Configurationif (!string.IsNullOrWhiteSpace(newPath)&& !string.Equals(Configuration.CertificatePath, newPath, StringComparison.Ordinal)){- // Validateif (!File.Exists(newPath)){throw new FileNotFoundException(@@ -133,7 +132,6 @@ namespace Emby.Server.Implementations.Configurationif (!string.IsNullOrWhiteSpace(newPath)&& !string.Equals(Configuration.MetadataPath, newPath, StringComparison.Ordinal)){- // Validateif (!Directory.Exists(newPath)){throw new DirectoryNotFoundException(@@ -146,60 +144,5 @@ namespace Emby.Server.Implementations.ConfigurationEnsureWriteAccess(newPath);}}-- /// <summary>- /// Sets all configuration values to their optimal values.- /// </summary>- /// <returns>If the configuration changed.</returns>- public bool SetOptimalValues()- {- var config = Configuration;-- var changed = false;-- if (!config.EnableCaseSensitiveItemIds)- {- config.EnableCaseSensitiveItemIds = true;- changed = true;- }-- if (!config.SkipDeserializationForBasicTypes)- {- config.SkipDeserializationForBasicTypes = true;- changed = true;- }-- if (!config.EnableSimpleArtistDetection)- {- config.EnableSimpleArtistDetection = true;- changed = true;- }-- if (!config.EnableNormalizedItemByNameIds)- {- config.EnableNormalizedItemByNameIds = true;- changed = true;- }-- if (!config.DisableLiveTvChannelUserDataName)- {- config.DisableLiveTvChannelUserDataName = true;- changed = true;- }-- if (!config.EnableNewOmdbSupport)- {- config.EnableNewOmdbSupport = true;- changed = true;- }-- if (!config.CollectionsUpgraded)- {- config.CollectionsUpgraded = true;- changed = true;- }-- return changed;- }}}diff --git a/Jellyfin.Api/Controllers/StartupController.cs b/Jellyfin.Api/Controllers/StartupController.csindex 6ec0a4e26f..04f134b8bf 100644--- a/Jellyfin.Api/Controllers/StartupController.cs+++ b/Jellyfin.Api/Controllers/StartupController.cs@@ -36,7 +36,6 @@ namespace Jellyfin.Api.Controllerspublic void CompleteWizard(){_config.Configuration.IsStartupWizardCompleted = true;- _config.SetOptimalValues();_config.SaveConfiguration();}diff --git a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.csindex a5c5e3bccf..43ad04dbac 100644--- a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs+++ b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs@@ -19,7 +19,5 @@ namespace MediaBrowser.Controller.Configuration/// </summary>/// <value>The configuration.</value>ServerConfiguration Configuration { get; }-- bool SetOptimalValues();}}diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.csindex b87c8fbab2..bb4ca34fd0 100644--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs@@ -82,8 +82,6 @@ namespace MediaBrowser.Model.Configurationpublic bool EnableRemoteAccess { get; set; }- public bool CollectionsUpgraded { get; set; }-/// <summary>/// Gets or sets a value indicating whether [enable case sensitive item ids]./// </summary>@@ -269,6 +267,7 @@ namespace MediaBrowser.Model.ConfigurationPathSubstitutions = Array.Empty<PathSubstitution>();IgnoreVirtualInterfaces = false;EnableSimpleArtistDetection = false;+ SkipDeserializationForBasicTypes = true;DisplaySpecialsWithinSeasons = true;EnableExternalContentInSuggestions = true;@@ -282,6 +281,9 @@ namespace MediaBrowser.Model.ConfigurationEnableHttps = false;EnableDashboardResponseCaching = true;EnableCaseSensitiveItemIds = true;+ EnableNormalizedItemByNameIds = true;+ DisableLiveTvChannelUserDataName = true;+ EnableNewOmdbSupport = true;AutoRunWebApp = true;EnableRemoteAccess = true;