diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-10-03 11:24:32 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-10-03 11:24:32 -0400 |
| commit | d021e20249c85ab96783e1347d95f826a816ff9b (patch) | |
| tree | d91ff481ab6617528c5be71b05496170d7d95d7b /MediaBrowser.Controller/Entities/Folder.cs | |
| parent | 16fd474ad3e7d74cd78779350d2ee0ea7017f627 (diff) | |
improve shortcut performance
Diffstat (limited to 'MediaBrowser.Controller/Entities/Folder.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/Folder.cs | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 5e6b02e08..95a68c009 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -4,7 +4,6 @@ using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Localization; -using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Resolvers; using MediaBrowser.Model.Entities; using System; @@ -1140,12 +1139,30 @@ namespace MediaBrowser.Controller.Entities throw new ArgumentException("Encountered linked child with empty path."); } - var item = LibraryManager.RootFolder.FindByPath(info.Path); + BaseItem item = null; + // First get using the cached Id + if (info.ItemId != Guid.Empty) + { + item = LibraryManager.GetItemById(info.ItemId); + } + + // If still null, search by path + if (item == null) + { + item = LibraryManager.RootFolder.FindByPath(info.Path); + } + + // If still null, log if (item == null) { Logger.Warn("Unable to find linked item at {0}", info.Path); } + else + { + // Cache the id for next time + info.ItemId = item.Id; + } return item; } @@ -1215,7 +1232,7 @@ namespace MediaBrowser.Controller.Entities .Where(i => i != null) .ToList(); - if (!newShortcutLinks.SequenceEqual(currentShortcutLinks)) + if (!newShortcutLinks.SequenceEqual(currentShortcutLinks, new LinkedChildComparer())) { Logger.Info("Shortcut links have changed for {0}", Path); |
