From de5a8d579bbc08be23ea7c3d250f33106d3aabd2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 24 Sep 2017 16:23:56 -0400 Subject: move season zero display name to per library settings --- .../Library/LibraryManager.cs | 53 +--------------------- 1 file changed, 1 insertion(+), 52 deletions(-) (limited to 'Emby.Server.Implementations/Library/LibraryManager.cs') diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 5871e180e..85b91ac25 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -247,11 +247,6 @@ namespace Emby.Server.Implementations.Library } } - /// - /// The _season zero display name - /// - private string _seasonZeroDisplayName; - private bool _wizardCompleted; /// /// Records the configuration values. @@ -259,7 +254,6 @@ namespace Emby.Server.Implementations.Library /// The configuration. private void RecordConfigurationValues(ServerConfiguration configuration) { - _seasonZeroDisplayName = configuration.SeasonZeroDisplayName; _wizardCompleted = configuration.IsStartupWizardCompleted; } @@ -272,59 +266,14 @@ namespace Emby.Server.Implementations.Library { var config = ConfigurationManager.Configuration; - var newSeasonZeroName = ConfigurationManager.Configuration.SeasonZeroDisplayName; - var seasonZeroNameChanged = !string.Equals(_seasonZeroDisplayName, newSeasonZeroName, StringComparison.Ordinal); var wizardChanged = config.IsStartupWizardCompleted != _wizardCompleted; RecordConfigurationValues(config); - if (seasonZeroNameChanged || wizardChanged) + if (wizardChanged) { _taskManager.CancelIfRunningAndQueue(); } - - if (seasonZeroNameChanged) - { - Task.Run(async () => - { - await UpdateSeasonZeroNames(newSeasonZeroName, CancellationToken.None).ConfigureAwait(false); - - }); - } - } - - /// - /// Updates the season zero names. - /// - /// The new name. - /// The cancellation token. - /// Task. - private async Task UpdateSeasonZeroNames(string newName, CancellationToken cancellationToken) - { - var seasons = GetItemList(new InternalItemsQuery - { - IncludeItemTypes = new[] { typeof(Season).Name }, - Recursive = true, - IndexNumber = 0, - DtoOptions = new DtoOptions(true) - - }).Cast() - .Where(i => !string.Equals(i.Name, newName, StringComparison.Ordinal)) - .ToList(); - - foreach (var season in seasons) - { - season.Name = newName; - - try - { - await UpdateItem(season, ItemUpdateType.MetadataDownload, cancellationToken).ConfigureAwait(false); - } - catch (Exception ex) - { - _logger.ErrorException("Error saving {0}", ex, season.Path); - } - } } public void RegisterItem(BaseItem item) -- cgit v1.2.3