diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-10-01 23:35:45 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-01 23:35:45 -0400 |
| commit | a73da532d52ae68ad01965dbf368bacc7d56a218 (patch) | |
| tree | a6f05e95515f822dfc129c36554f74f1da4d4c23 /Emby.Server.Implementations/Library/LibraryManager.cs | |
| parent | f651fd6ffba80a6f8e54fca7d014622692cc08f7 (diff) | |
| parent | 796f374359d75e22d2095b3f3a8f9b220cacde27 (diff) | |
Merge pull request #2931 from MediaBrowser/beta
Beta
Diffstat (limited to 'Emby.Server.Implementations/Library/LibraryManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/LibraryManager.cs | 61 |
1 files changed, 9 insertions, 52 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index eab52e5e8..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 } } - /// <summary> - /// The _season zero display name - /// </summary> - private string _seasonZeroDisplayName; - private bool _wizardCompleted; /// <summary> /// Records the configuration values. @@ -259,7 +254,6 @@ namespace Emby.Server.Implementations.Library /// <param name="configuration">The configuration.</param> 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<RefreshMediaLibraryTask>(); } - - if (seasonZeroNameChanged) - { - Task.Run(async () => - { - await UpdateSeasonZeroNames(newSeasonZeroName, CancellationToken.None).ConfigureAwait(false); - - }); - } - } - - /// <summary> - /// Updates the season zero names. - /// </summary> - /// <param name="newName">The new name.</param> - /// <param name="cancellationToken">The cancellation token.</param> - /// <returns>Task.</returns> - 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<Season>() - .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) @@ -433,6 +382,14 @@ namespace Emby.Server.Implementations.Library _fileSystem.DeleteFile(fileSystemInfo.FullName); } } + catch (FileNotFoundException) + { + // may have already been deleted manually by user + } + catch (DirectoryNotFoundException) + { + // may have already been deleted manually by user + } catch (IOException) { if (isRequiredForDelete) |
