本文整理汇总了C#中MediaBrowser.Controller.Entities.InternalItemsQuery类的典型用法代码示例。如果您正苦于以下问题:C# InternalItemsQuery类的具体用法?C# InternalItemsQuery怎么用?C# InternalItemsQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InternalItemsQuery类属于MediaBrowser.Controller.Entities命名空间,在下文中一共展示了InternalItemsQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTaggedItems
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
{
query.Genres = new[] { Name };
query.ExcludeItemTypes = new[] { typeof(Game).Name, typeof(MusicVideo).Name, typeof(Audio.Audio).Name, typeof(MusicAlbum).Name, typeof(MusicArtist).Name };
return LibraryManager.GetItemList(query);
}
示例2: GetTaggedItems
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
{
query.Genres = new[] { Name };
query.IncludeItemTypes = new[] { typeof(Game).Name };
return LibraryManager.GetItemList(query);
}
示例3: GetItems
public override async Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
{
try
{
// Don't blow up here because it could cause parent screens with other content to fail
return await ChannelManager.GetChannelItemsInternal(new ChannelItemQuery
{
ChannelId = ChannelId,
FolderId = Id.ToString("N"),
Limit = query.Limit,
StartIndex = query.StartIndex,
UserId = query.User.Id.ToString("N"),
SortBy = query.SortBy,
SortOrder = query.SortOrder
}, new Progress<double>(), CancellationToken.None);
}
catch
{
// Already logged at lower levels
return new QueryResult<BaseItem>
{
};
}
}
示例4: GetRecursiveChildren
public override IEnumerable<BaseItem> GetRecursiveChildren(User user, InternalItemsQuery query)
{
var items = GetPlayableItems(user).Result;
if (query != null)
{
items = items.Where(i => UserViewBuilder.FilterItem(i, query));
}
return items;
}
示例5: GetItems
public override Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
{
var parent = this as Folder;
if (ParentId != Guid.Empty)
{
parent = LibraryManager.GetItemById(ParentId) as Folder ?? parent;
}
return new UserViewBuilder(UserViewManager, LiveTvManager, ChannelManager, LibraryManager, Logger, UserDataManager, TVSeriesManager, CollectionManager, PlaylistManager)
.GetUserItems(parent, this, ViewType, query);
}
示例6: GetTaggedItems
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
{
int year;
var usCulture = new CultureInfo("en-US");
if (!int.TryParse(Name, NumberStyles.Integer, usCulture, out year))
{
return new List<BaseItem>();
}
query.Years = new[] { year };
return LibraryManager.GetItemList(query);
}
示例7: GetItems
public override async Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
{
if (query.Recursive)
{
var items = query.User.RootFolder.GetRecursiveChildren(query.User);
return SortAndFilter(items, query);
}
var result = await UserViewManager.GetUserViews(new UserViewQuery
{
UserId = query.User.Id.ToString("N")
}, CancellationToken.None).ConfigureAwait(false);
return SortAndFilter(result, query);
}
示例8: GetItems
public override async Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
{
var user = query.User;
Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager);
if (query.Recursive)
{
var items = query.User.RootFolder.GetRecursiveChildren(query.User, filter);
return PostFilterAndSort(items, query);
}
var result = await UserViewManager.GetUserViews(new UserViewQuery
{
UserId = query.User.Id.ToString("N")
}, CancellationToken.None).ConfigureAwait(false);
return PostFilterAndSort(result.Where(filter), query);
}
示例9: GetItemsInternal
protected override async Task<QueryResult<BaseItem>> GetItemsInternal(InternalItemsQuery query)
{
if (query.Recursive)
{
return QueryRecursive(query);
}
var result = await UserViewManager.GetUserViews(new UserViewQuery
{
UserId = query.User.Id.ToString("N"),
PresetViews = query.PresetViews
}, CancellationToken.None).ConfigureAwait(false);
var user = query.User;
Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager);
return PostFilterAndSort(result.Where(filter), query, true, true);
}
示例10: PostFilterAndSort
protected QueryResult<BaseItem> PostFilterAndSort(IEnumerable<BaseItem> items, InternalItemsQuery query)
{
return UserViewBuilder.PostFilterAndSort(items, this, null, query, LibraryManager);
}
示例11: MarkPlayed
/// <summary>
/// Marks the played.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="datePlayed">The date played.</param>
/// <param name="resetPosition">if set to <c>true</c> [reset position].</param>
/// <returns>Task.</returns>
public override async Task MarkPlayed(User user,
DateTime? datePlayed,
bool resetPosition)
{
var query = new InternalItemsQuery
{
User = user,
Recursive = true,
IsFolder = false,
IsUnaired = false
};
if (!user.Configuration.DisplayMissingEpisodes)
{
query.IsMissing = false;
}
var itemsResult = await GetItems(query).ConfigureAwait(false);
// Sweep through recursively and update status
var tasks = itemsResult.Items.Select(c => c.MarkPlayed(user, datePlayed, resetPosition));
await Task.WhenAll(tasks).ConfigureAwait(false);
}
示例12: GetItems
public Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
{
if (query.ItemIds.Length > 0)
{
var specificItems = query.ItemIds.Select(LibraryManager.GetItemById).Where(i => i != null).ToList();
return Task.FromResult(PostFilterAndSort(specificItems, query));
}
return GetItemsInternal(query);
}
示例13: GetItemsInternal
protected virtual async Task<QueryResult<BaseItem>> GetItemsInternal(InternalItemsQuery query)
{
if (SourceType == SourceType.Channel)
{
try
{
// Don't blow up here because it could cause parent screens with other content to fail
return await ChannelManager.GetChannelItemsInternal(new ChannelItemQuery
{
ChannelId = ChannelId,
FolderId = Id.ToString("N"),
Limit = query.Limit,
StartIndex = query.StartIndex,
UserId = query.User.Id.ToString("N"),
SortBy = query.SortBy,
SortOrder = query.SortOrder
}, new Progress<double>(), CancellationToken.None);
}
catch
{
// Already logged at lower levels
return new QueryResult<BaseItem>
{
};
}
}
if (query.Recursive)
{
return QueryRecursive(query);
}
var user = query.User;
Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager);
IEnumerable<BaseItem> items;
if (query.User == null)
{
items = query.Recursive
? GetRecursiveChildren(filter)
: Children.Where(filter);
}
else
{
items = query.Recursive
? GetRecursiveChildren(user, filter)
: GetChildren(user, true).Where(filter);
}
return PostFilterAndSort(items, query);
}
示例14: GetRecommendedProgramsInternal
public async Task<QueryResult<LiveTvProgram>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, CancellationToken cancellationToken)
{
var internalQuery = new InternalItemsQuery
{
IncludeItemTypes = new[] { typeof(LiveTvProgram).Name },
IsAiring = query.IsAiring,
IsMovie = query.IsMovie,
IsSports = query.IsSports
};
if (query.HasAired.HasValue)
{
if (query.HasAired.Value)
{
internalQuery.MaxEndDate = DateTime.UtcNow;
}
else
{
internalQuery.MinEndDate = DateTime.UtcNow;
}
}
IEnumerable<LiveTvProgram> programs = _libraryManager.GetItems(internalQuery).Items.Cast<LiveTvProgram>();
var user = _userManager.GetUserById(query.UserId);
// Avoid implicitly captured closure
var currentUser = user;
programs = programs.Where(i => i.IsVisible(currentUser));
var programList = programs.ToList();
var genres = programList.SelectMany(i => i.Genres)
.DistinctNames()
.Select(i => _libraryManager.GetGenre(i))
.ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase);
programs = programList.OrderBy(i => i.HasImage(ImageType.Primary) ? 0 : 1)
.ThenByDescending(i => GetRecommendationScore(i, user.Id, genres))
.ThenBy(i => i.StartDate);
if (query.Limit.HasValue)
{
programs = programs.Take(query.Limit.Value)
.OrderBy(i => i.StartDate);
}
programList = programs.ToList();
var returnArray = programList.ToArray();
var result = new QueryResult<LiveTvProgram>
{
Items = returnArray,
TotalRecordCount = returnArray.Length
};
return result;
}
示例15: GetRecommendedProgramsInternal
public async Task<QueryResult<LiveTvProgram>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, CancellationToken cancellationToken)
{
var user = _userManager.GetUserById(query.UserId);
var internalQuery = new InternalItemsQuery
{
IncludeItemTypes = new[] { typeof(LiveTvProgram).Name },
IsAiring = query.IsAiring,
IsMovie = query.IsMovie,
IsSports = query.IsSports,
IsKids = query.IsKids
};
if (user != null)
{
internalQuery.MaxParentalRating = user.Policy.MaxParentalRating;
if (user.Policy.BlockUnratedItems.Contains(UnratedItem.LiveTvProgram))
{
internalQuery.HasParentalRating = true;
}
}
if (query.HasAired.HasValue)
{
if (query.HasAired.Value)
{
internalQuery.MaxEndDate = DateTime.UtcNow;
}
else
{
internalQuery.MinEndDate = DateTime.UtcNow;
}
}
IEnumerable<LiveTvProgram> programs = _libraryManager.QueryItems(internalQuery).Items.Cast<LiveTvProgram>();
var programList = programs.ToList();
var genres = programList.SelectMany(i => i.Genres)
.Where(i => !string.IsNullOrWhiteSpace(i))
.DistinctNames()
.Select(i => _libraryManager.GetGenre(i))
.DistinctBy(i => i.Id)
.ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase);
programs = programList.OrderBy(i => i.HasImage(ImageType.Primary) ? 0 : 1)
.ThenByDescending(i => GetRecommendationScore(i, user.Id, genres))
.ThenBy(i => i.StartDate);
if (query.Limit.HasValue)
{
programs = programs.Take(query.Limit.Value);
}
programList = programs.ToList();
var returnArray = programList.ToArray();
var result = new QueryResult<LiveTvProgram>
{
Items = returnArray,
TotalRecordCount = returnArray.Length
};
return result;
}