mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 14:08:44 -04:00
Merge pull request #3455 from jellyfin/values
Use constructor to set optimal config values
This commit is contained in:
commit
9a44e2912e
5 changed files with 4 additions and 118 deletions
|
@ -363,60 +363,4 @@ namespace Emby.Server.Implementations.Collections
|
||||||
return results.Values;
|
return 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,6 @@ namespace Emby.Server.Implementations.Configuration
|
||||||
if (!string.IsNullOrWhiteSpace(newPath)
|
if (!string.IsNullOrWhiteSpace(newPath)
|
||||||
&& !string.Equals(Configuration.CertificatePath, newPath, StringComparison.Ordinal))
|
&& !string.Equals(Configuration.CertificatePath, newPath, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
// Validate
|
|
||||||
if (!File.Exists(newPath))
|
if (!File.Exists(newPath))
|
||||||
{
|
{
|
||||||
throw new FileNotFoundException(
|
throw new FileNotFoundException(
|
||||||
|
@ -133,7 +132,6 @@ namespace Emby.Server.Implementations.Configuration
|
||||||
if (!string.IsNullOrWhiteSpace(newPath)
|
if (!string.IsNullOrWhiteSpace(newPath)
|
||||||
&& !string.Equals(Configuration.MetadataPath, newPath, StringComparison.Ordinal))
|
&& !string.Equals(Configuration.MetadataPath, newPath, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
// Validate
|
|
||||||
if (!Directory.Exists(newPath))
|
if (!Directory.Exists(newPath))
|
||||||
{
|
{
|
||||||
throw new DirectoryNotFoundException(
|
throw new DirectoryNotFoundException(
|
||||||
|
@ -146,60 +144,5 @@ namespace Emby.Server.Implementations.Configuration
|
||||||
EnsureWriteAccess(newPath);
|
EnsureWriteAccess(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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ namespace Jellyfin.Api.Controllers
|
||||||
public void CompleteWizard()
|
public void CompleteWizard()
|
||||||
{
|
{
|
||||||
_config.Configuration.IsStartupWizardCompleted = true;
|
_config.Configuration.IsStartupWizardCompleted = true;
|
||||||
_config.SetOptimalValues();
|
|
||||||
_config.SaveConfiguration();
|
_config.SaveConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,5 @@ namespace MediaBrowser.Controller.Configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The configuration.</value>
|
/// <value>The configuration.</value>
|
||||||
ServerConfiguration Configuration { get; }
|
ServerConfiguration Configuration { get; }
|
||||||
|
|
||||||
bool SetOptimalValues();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,6 @@ namespace MediaBrowser.Model.Configuration
|
||||||
|
|
||||||
public bool EnableRemoteAccess { get; set; }
|
public bool EnableRemoteAccess { get; set; }
|
||||||
|
|
||||||
public bool CollectionsUpgraded { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether [enable case sensitive item ids].
|
/// Gets or sets a value indicating whether [enable case sensitive item ids].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -269,6 +267,7 @@ namespace MediaBrowser.Model.Configuration
|
||||||
PathSubstitutions = Array.Empty<PathSubstitution>();
|
PathSubstitutions = Array.Empty<PathSubstitution>();
|
||||||
IgnoreVirtualInterfaces = false;
|
IgnoreVirtualInterfaces = false;
|
||||||
EnableSimpleArtistDetection = false;
|
EnableSimpleArtistDetection = false;
|
||||||
|
SkipDeserializationForBasicTypes = true;
|
||||||
|
|
||||||
DisplaySpecialsWithinSeasons = true;
|
DisplaySpecialsWithinSeasons = true;
|
||||||
EnableExternalContentInSuggestions = true;
|
EnableExternalContentInSuggestions = true;
|
||||||
|
@ -282,6 +281,9 @@ namespace MediaBrowser.Model.Configuration
|
||||||
EnableHttps = false;
|
EnableHttps = false;
|
||||||
EnableDashboardResponseCaching = true;
|
EnableDashboardResponseCaching = true;
|
||||||
EnableCaseSensitiveItemIds = true;
|
EnableCaseSensitiveItemIds = true;
|
||||||
|
EnableNormalizedItemByNameIds = true;
|
||||||
|
DisableLiveTvChannelUserDataName = true;
|
||||||
|
EnableNewOmdbSupport = true;
|
||||||
|
|
||||||
AutoRunWebApp = true;
|
AutoRunWebApp = true;
|
||||||
EnableRemoteAccess = true;
|
EnableRemoteAccess = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue