update querying

This commit is contained in:
Luke Pulverenti
2015-11-14 13:57:26 -05:00
parent 743102b88f
commit f6e73a428e
7 changed files with 136 additions and 24 deletions

View File

@@ -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
{

View File

@@ -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]

View File

@@ -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[] { };
}

View File

@@ -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);