mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-04 06:48:35 +01:00
update querying
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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[] { };
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user