From 80fb3c9eb4a94b435f56e9011853aae4397f6af9 Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Mon, 19 Aug 2013 17:17:03 -0400 Subject: [PATCH] Initial support of shortcuts everywhere --- .../Entities/AggregateFolder.cs | 11 +++++++ .../Entities/CollectionFolder.cs | 32 +++++++++++++++++++ MediaBrowser.Controller/Entities/Folder.cs | 4 +-- .../Entities/Movies/BoxSet.cs | 7 ---- 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs index c4fda4fa27..302842e7e8 100644 --- a/MediaBrowser.Controller/Entities/AggregateFolder.cs +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -11,6 +11,17 @@ namespace MediaBrowser.Controller.Entities /// public class AggregateFolder : Folder { + /// + /// We don't support manual shortcuts + /// + protected override bool SupportsShortcutChildren + { + get + { + return false; + } + } + /// /// The _virtual children /// diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 7d7d60ae53..b080478b80 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -67,6 +67,38 @@ namespace MediaBrowser.Controller.Entities return NullTaskResult; } + /// + /// Our children are actually just references to the ones in the physical root... + /// + /// The linked children. + public override List LinkedChildren + { + get + { + ItemResolveArgs resolveArgs; + + try + { + resolveArgs = ResolveArgs; + } + catch (IOException ex) + { + Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path); + return new List(); + } + + return LibraryManager.RootFolder.RecursiveChildren + .OfType() + .Where(i => i.Path != null && resolveArgs.PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase)) + .SelectMany(c => c.LinkedChildren).ToList(); + + } + set + { + base.LinkedChildren = value; + } + } + /// /// Our children are actually just references to the ones in the physical root... /// diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 3eda96d3d2..ca43ca616b 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -81,11 +81,11 @@ namespace MediaBrowser.Controller.Entities } } - public List LinkedChildren { get; set; } + public virtual List LinkedChildren { get; set; } protected virtual bool SupportsShortcutChildren { - get { return false; } + get { return true; } } /// diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs index 5c99a62f7d..e52ece502b 100644 --- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs +++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs @@ -6,12 +6,5 @@ namespace MediaBrowser.Controller.Entities.Movies /// public class BoxSet : Folder { - protected override bool SupportsShortcutChildren - { - get - { - return true; - } - } } }