diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/Collections/CollectionManager.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Collections/CollectionManager.cs | 40 |
1 files changed, 5 insertions, 35 deletions
diff --git a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs index 1b6c44c5e..cb2bd645d 100644 --- a/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs +++ b/MediaBrowser.Server.Implementations/Collections/CollectionManager.cs @@ -219,7 +219,9 @@ namespace MediaBrowser.Server.Implementations.Collections foreach (var itemId in itemIds) { - var child = collection.LinkedChildren.FirstOrDefault(i => i.ItemId.HasValue && i.ItemId.Value == itemId); + var childItem = _libraryManager.GetItemById(itemId); + + var child = collection.LinkedChildren.FirstOrDefault(i => (i.ItemId.HasValue && i.ItemId.Value == itemId) || (childItem != null && string.Equals(childItem.Path, i.Path, StringComparison.OrdinalIgnoreCase))); if (child == null) { @@ -228,47 +230,15 @@ namespace MediaBrowser.Server.Implementations.Collections list.Add(child); - var childItem = _libraryManager.GetItemById(itemId); - if (childItem != null) { itemList.Add(childItem); } } - var shortcutFiles = _fileSystem - .GetFilePaths(collection.Path) - .Where(i => _fileSystem.IsShortcut(i)) - .ToList(); - - var shortcutFilesToDelete = list.Where(child => !string.IsNullOrWhiteSpace(child.Path) && child.Type == LinkedChildType.Shortcut) - .Select(child => shortcutFiles.FirstOrDefault(i => string.Equals(child.Path, _fileSystem.ResolveShortcut(i), StringComparison.OrdinalIgnoreCase))) - .Where(i => !string.IsNullOrWhiteSpace(i)) - .ToList(); - - foreach (var file in shortcutFilesToDelete) - { - _iLibraryMonitor.ReportFileSystemChangeBeginning(file); - } - - try - { - foreach (var file in shortcutFilesToDelete) - { - _fileSystem.DeleteFile(file); - } - - foreach (var child in list) - { - collection.LinkedChildren.Remove(child); - } - } - finally + foreach (var child in list) { - foreach (var file in shortcutFilesToDelete) - { - _iLibraryMonitor.ReportFileSystemChangeComplete(file, false); - } + collection.LinkedChildren.Remove(child); } collection.UpdateRatingToContent(); |
