diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-10-12 15:44:48 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-10-12 15:44:48 -0400 |
| commit | 673e2c9d0fa3e93047ea7845adab53d39f1d6554 (patch) | |
| tree | c18ade85980b01eff06d35ad03f9331a8bfcb07e /MediaBrowser.Server.Implementations/Collections/CollectionManager.cs | |
| parent | 3aabe6aa1933a7a9412651e3eff4bc20e97881c3 (diff) | |
| parent | 25ef9777cafee83c46ff53ede2caa04e3295e98a (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/Emby
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(); |
