2014-09-01 20:10:54 +00:00
|
|
|
|
using MediaBrowser.Controller.TV;
|
2014-06-05 02:32:40 +00:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
2014-09-01 20:10:54 +00:00
|
|
|
|
using MediaBrowser.Model.Querying;
|
2014-06-05 02:32:40 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2014-08-14 13:24:30 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2014-06-05 02:32:40 +00:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Entities
|
|
|
|
|
{
|
|
|
|
|
public class UserView : Folder
|
|
|
|
|
{
|
|
|
|
|
public string ViewType { get; set; }
|
2014-09-01 20:10:54 +00:00
|
|
|
|
public Guid ParentId { get; set; }
|
2014-06-05 02:32:40 +00:00
|
|
|
|
|
2014-09-01 20:10:54 +00:00
|
|
|
|
public static ITVSeriesManager TVSeriesManager;
|
|
|
|
|
|
2014-10-06 23:58:46 +00:00
|
|
|
|
public override Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
|
2014-06-05 02:32:40 +00:00
|
|
|
|
{
|
2014-10-08 01:37:45 +00:00
|
|
|
|
return new UserViewBuilder(UserViewManager, LiveTvManager, ChannelManager, LibraryManager, Logger, UserDataManager, TVSeriesManager, CollectionManager)
|
2014-09-01 20:10:54 +00:00
|
|
|
|
.GetUserItems(this, ViewType, query);
|
|
|
|
|
}
|
2014-06-05 02:32:40 +00:00
|
|
|
|
|
2014-09-01 20:10:54 +00:00
|
|
|
|
public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)
|
|
|
|
|
{
|
2014-10-06 23:58:46 +00:00
|
|
|
|
var result = GetItems(new InternalItemsQuery
|
2014-06-05 02:32:40 +00:00
|
|
|
|
{
|
2014-09-01 20:10:54 +00:00
|
|
|
|
User = user
|
2014-08-14 13:24:30 +00:00
|
|
|
|
|
2014-09-01 20:10:54 +00:00
|
|
|
|
}).Result;
|
2014-08-14 13:24:30 +00:00
|
|
|
|
|
2014-09-01 20:10:54 +00:00
|
|
|
|
return result.Items;
|
2014-06-05 02:32:40 +00:00
|
|
|
|
}
|
2014-08-14 13:24:30 +00:00
|
|
|
|
|
2014-09-01 20:10:54 +00:00
|
|
|
|
public override IEnumerable<BaseItem> GetRecursiveChildren(User user, bool includeLinkedChildren = true)
|
2014-08-14 13:24:30 +00:00
|
|
|
|
{
|
2014-10-06 23:58:46 +00:00
|
|
|
|
var result = GetItems(new InternalItemsQuery
|
2014-09-01 20:10:54 +00:00
|
|
|
|
{
|
|
|
|
|
User = user,
|
|
|
|
|
Recursive = true
|
2014-08-14 13:24:30 +00:00
|
|
|
|
|
2014-09-01 20:10:54 +00:00
|
|
|
|
}).Result;
|
2014-08-14 13:24:30 +00:00
|
|
|
|
|
2014-09-01 20:10:54 +00:00
|
|
|
|
return result.Items;
|
2014-08-14 13:24:30 +00:00
|
|
|
|
}
|
2014-06-05 02:32:40 +00:00
|
|
|
|
|
|
|
|
|
protected override IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)
|
|
|
|
|
{
|
|
|
|
|
return GetChildren(user, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool IsExcludedFromGrouping(Folder folder)
|
|
|
|
|
{
|
|
|
|
|
var standaloneTypes = new List<string>
|
|
|
|
|
{
|
|
|
|
|
CollectionType.AdultVideos,
|
|
|
|
|
CollectionType.Books,
|
|
|
|
|
CollectionType.HomeVideos,
|
|
|
|
|
CollectionType.Photos,
|
|
|
|
|
CollectionType.Trailers
|
|
|
|
|
};
|
|
|
|
|
|
2014-10-12 01:46:02 +00:00
|
|
|
|
var collectionFolder = folder as ICollectionFolder;
|
2014-06-05 02:32:40 +00:00
|
|
|
|
|
|
|
|
|
if (collectionFolder == null)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return standaloneTypes.Contains(collectionFolder.CollectionType ?? string.Empty);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|