aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/Entities')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs30
-rw-r--r--MediaBrowser.Controller/Entities/CollectionFolder.cs15
-rw-r--r--MediaBrowser.Controller/Entities/InternalItemsQuery.cs2
-rw-r--r--MediaBrowser.Controller/Entities/UserView.cs3
4 files changed, 42 insertions, 8 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index d8bb51003..252689b4a 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -1939,6 +1939,36 @@ namespace MediaBrowser.Controller.Entities
return GetParents().Select(i => i.Id).Concat(LibraryManager.GetCollectionFolders(this).Select(i => i.Id));
}
+ public BaseItem GetTopParent()
+ {
+ if (IsTopParent)
+ {
+ return this;
+ }
+
+ return GetParents().FirstOrDefault(i => i.IsTopParent);
+ }
+
+ [IgnoreDataMember]
+ public virtual bool IsTopParent
+ {
+ get
+ {
+ if (GetParent() is AggregateFolder || this is Channel || this is BasePluginFolder)
+ {
+ return true;
+ }
+
+ var view = this as UserView;
+ if (view != null && string.Equals(view.ViewType, CollectionType.LiveTv, StringComparison.OrdinalIgnoreCase))
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+
[IgnoreDataMember]
public virtual bool SupportsAncestors
{
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index 0da253186..b2c7c2fa8 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -181,9 +181,7 @@ namespace MediaBrowser.Controller.Entities
}
private List<LinkedChild> GetLinkedChildrenInternal()
{
- return LibraryManager.RootFolder.Children
- .OfType<Folder>()
- .Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase))
+ return GetPhysicalParents()
.SelectMany(c => c.LinkedChildren)
.ToList();
}
@@ -199,11 +197,14 @@ namespace MediaBrowser.Controller.Entities
private IEnumerable<BaseItem> GetActualChildren()
{
- return
- LibraryManager.RootFolder.Children
+ return GetPhysicalParents().SelectMany(c => c.Children);
+ }
+
+ public IEnumerable<Folder> GetPhysicalParents()
+ {
+ return LibraryManager.RootFolder.Children
.OfType<Folder>()
- .Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase))
- .SelectMany(c => c.Children);
+ .Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase));
}
[IgnoreDataMember]
diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
index 944a144ec..682cec69d 100644
--- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
+++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs
@@ -107,6 +107,7 @@ namespace MediaBrowser.Controller.Entities
public Guid? ParentId { get; set; }
public string[] AncestorIds { get; set; }
+ public string[] TopParentIds { get; set; }
public LocationType[] ExcludeLocationTypes { get; set; }
@@ -131,6 +132,7 @@ namespace MediaBrowser.Controller.Entities
ChannelIds = new string[] { };
ItemIds = new string[] { };
AncestorIds = new string[] { };
+ TopParentIds = new string[] { };
ExcludeLocationTypes = new LocationType[] { };
}
diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.cs
index df089b5b2..473c671ee 100644
--- a/MediaBrowser.Controller/Entities/UserView.cs
+++ b/MediaBrowser.Controller/Entities/UserView.cs
@@ -170,7 +170,8 @@ namespace MediaBrowser.Controller.Entities
{
CollectionType.Games,
CollectionType.Books,
- CollectionType.MusicVideos
+ CollectionType.MusicVideos ,
+ CollectionType.HomeVideos
};
return types.Contains(viewType ?? string.Empty, StringComparer.OrdinalIgnoreCase);