diff options
Diffstat (limited to 'MediaBrowser.Controller/Entities/Folder.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/Folder.cs | 79 |
1 files changed, 38 insertions, 41 deletions
diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index bf47ada0d..e5994fde5 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -22,13 +22,18 @@ namespace MediaBrowser.Controller.Entities /// <summary> /// Class Folder /// </summary> - public class Folder : BaseItem, IHasThemeMedia + public class Folder : BaseItem { public static IUserManager UserManager { get; set; } public static IUserViewManager UserViewManager { get; set; } - public List<Guid> ThemeSongIds { get; set; } - public List<Guid> ThemeVideoIds { get; set; } + /// <summary> + /// Gets or sets a value indicating whether this instance is root. + /// </summary> + /// <value><c>true</c> if this instance is root; otherwise, <c>false</c>.</value> + public bool IsRoot { get; set; } + + public virtual List<LinkedChild> LinkedChildren { get; set; } [IgnoreDataMember] public DateTime? DateLastMediaAdded { get; set; } @@ -36,9 +41,12 @@ namespace MediaBrowser.Controller.Entities public Folder() { LinkedChildren = new List<LinkedChild>(); + } - ThemeSongIds = new List<Guid>(); - ThemeVideoIds = new List<Guid>(); + [IgnoreDataMember] + public override bool SupportsThemeMedia + { + get { return true; } } [IgnoreDataMember] @@ -47,6 +55,12 @@ namespace MediaBrowser.Controller.Entities get { return false; } } + [IgnoreDataMember] + public virtual bool IsPhysicalRoot + { + get { return false; } + } + /// <summary> /// Gets a value indicating whether this instance is folder. /// </summary> @@ -117,19 +131,6 @@ namespace MediaBrowser.Controller.Entities return true; } - /// <summary> - /// Gets or sets a value indicating whether this instance is physical root. - /// </summary> - /// <value><c>true</c> if this instance is physical root; otherwise, <c>false</c>.</value> - public bool IsPhysicalRoot { get; set; } - /// <summary> - /// Gets or sets a value indicating whether this instance is root. - /// </summary> - /// <value><c>true</c> if this instance is root; otherwise, <c>false</c>.</value> - public bool IsRoot { get; set; } - - public virtual List<LinkedChild> LinkedChildren { get; set; } - [IgnoreDataMember] protected virtual bool SupportsShortcutChildren { @@ -178,8 +179,6 @@ namespace MediaBrowser.Controller.Entities item.SetParent(null); } - #region Indexing - /// <summary> /// Returns the valid set of index by options for this folder type. /// Override or extend to modify. @@ -207,8 +206,6 @@ namespace MediaBrowser.Controller.Entities get { return GetIndexByOptions(); } } - #endregion - /// <summary> /// Gets the actual children. /// </summary> @@ -1057,11 +1054,21 @@ namespace MediaBrowser.Controller.Entities /// <returns>IList{BaseItem}.</returns> public IList<BaseItem> GetRecursiveChildren() { - return GetRecursiveChildren(i => true); + return GetRecursiveChildren(true); + } + + public IList<BaseItem> GetRecursiveChildren(bool includeLinkedChildren) + { + return GetRecursiveChildren(i => true, includeLinkedChildren); } public IList<BaseItem> GetRecursiveChildren(Func<BaseItem, bool> filter) { + return GetRecursiveChildren(filter, true); + } + + public IList<BaseItem> GetRecursiveChildren(Func<BaseItem, bool> filter, bool includeLinkedChildren) + { var result = new Dictionary<Guid, BaseItem>(); AddChildrenToList(result, true, true, filter); @@ -1139,29 +1146,19 @@ namespace MediaBrowser.Controller.Entities return LinkedChildren .Select(i => { - var requiresPostFilter = true; - - if (!string.IsNullOrWhiteSpace(i.Path)) - { - requiresPostFilter = false; - - if (!locations.Any(l => FileSystem.ContainsSubPath(l, i.Path))) - { - return null; - } - } - var child = GetLinkedChild(i); - if (requiresPostFilter && child != null) + if (child != null) { - if (string.IsNullOrWhiteSpace(child.Path)) + var childLocationType = child.LocationType; + if (childLocationType == LocationType.Remote || childLocationType == LocationType.Virtual) { - Logger.Debug("Found LinkedChild with null path: {0}", child.Name); - return child; + if (!child.IsVisibleStandalone(user)) + { + return null; + } } - - if (!locations.Any(l => FileSystem.ContainsSubPath(l, child.Path))) + else if (childLocationType == LocationType.FileSystem && !locations.Any(l => FileSystem.ContainsSubPath(l, child.Path))) { return null; } |
