本文整理汇总了C#中MediaBrowser.Controller.Entities.InternalItemsQuery类的典型用法代码示例。如果您正苦于以下问题:C# InternalItemsQuery类的具体用法?C# InternalItemsQuery怎么用?C# InternalItemsQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InternalItemsQuery类属于MediaBrowser.Controller.Entities命名空间,在下文中一共展示了InternalItemsQuery类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:7illusions,项目名称:Emby,代码行数:7,代码来源:Genre.cs
示例2: GetTaggedItems
public IEnumerable<BaseItem> GetTaggedItems(InternalItemsQuery query)
{
query.Genres = new[] { Name };
query.IncludeItemTypes = new[] { typeof(Game).Name };
return LibraryManager.GetItemList(query);
}
开发者ID:softworkz,项目名称:Emby,代码行数:7,代码来源:GameGenre.cs
示例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>
{
};
}
}
开发者ID:jrags56,项目名称:MediaBrowser,代码行数:26,代码来源:ChannelFolderItem.cs
示例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;
}
开发者ID:7illusions,项目名称:Emby,代码行数:11,代码来源:Playlist.cs
示例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);
}
开发者ID:redteamcpu,项目名称:Emby,代码行数:12,代码来源:UserView.cs
示例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);
}
开发者ID:paul-777,项目名称:Emby,代码行数:15,代码来源:Year.cs
示例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);
}
开发者ID:Ceten,项目名称:MediaBrowser,代码行数:16,代码来源:UserRootFolder.cs
示例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);
}
开发者ID:jrags56,项目名称:MediaBrowser,代码行数:19,代码来源:UserRootFolder.cs
示例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);
}
开发者ID:t-andre,项目名称:Emby,代码行数:19,代码来源:UserRootFolder.cs
示例10: PostFilterAndSort
protected QueryResult<BaseItem> PostFilterAndSort(IEnumerable<BaseItem> items, InternalItemsQuery query)
{
return UserViewBuilder.PostFilterAndSort(items, this, null, query, LibraryManager);
}
开发者ID:paul-777,项目名称:Emby,代码行数:4,代码来源:Folder.cs
示例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);
}
开发者ID:paul-777,项目名称:Emby,代码行数:32,代码来源:Folder.cs
示例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);
}
开发者ID:paul-777,项目名称:Emby,代码行数:10,代码来源:Folder.cs
示例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);
}
开发者ID:paul-777,项目名称:Emby,代码行数:55,代码来源:Folder.cs
示例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;
}
开发者ID:jrags56,项目名称:MediaBrowser,代码行数:59,代码来源:LiveTvManager.cs
示例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;
}
开发者ID:rezafouladian,项目名称:Emby,代码行数:67,代码来源:LiveTvManager.cs
示例16: GetItems
public virtual Task<QueryResult<BaseItem>> GetItems(InternalItemsQuery query)
{
var user = query.User;
var items = query.Recursive
? GetRecursiveChildren(user)
: GetChildren(user, true);
var result = SortAndFilter(items, query);
return Task.FromResult(result);
}
开发者ID:jabbera,项目名称:MediaBrowser,代码行数:12,代码来源:Folder.cs
示例17: GetItemsQuery
/// <summary> Gets items query. </summary>
/// <param name="request"> The request. </param>
/// <param name="user"> The user. </param>
/// <returns> The items query. </returns>
private InternalItemsQuery GetItemsQuery(BaseReportRequest request, User user)
{
var query = new InternalItemsQuery
{
User = user,
IsPlayed = request.IsPlayed,
MediaTypes = request.GetMediaTypes(),
IncludeItemTypes = request.GetIncludeItemTypes(),
ExcludeItemTypes = request.GetExcludeItemTypes(),
Recursive = request.Recursive,
SortBy = request.GetOrderBy(),
SortOrder = request.SortOrder ?? SortOrder.Ascending,
IsFavorite = request.IsFavorite,
Limit = request.Limit,
StartIndex = request.StartIndex,
IsMissing = request.IsMissing,
IsVirtualUnaired = request.IsVirtualUnaired,
IsUnaired = request.IsUnaired,
CollapseBoxSetItems = request.CollapseBoxSetItems,
NameLessThan = request.NameLessThan,
NameStartsWith = request.NameStartsWith,
NameStartsWithOrGreater = request.NameStartsWithOrGreater,
HasImdbId = request.HasImdbId,
IsYearMismatched = request.IsYearMismatched,
IsPlaceHolder = request.IsPlaceHolder,
IsLocked = request.IsLocked,
IsInBoxSet = request.IsInBoxSet,
IsHD = request.IsHD,
Is3D = request.Is3D,
HasTvdbId = request.HasTvdbId,
HasTmdbId = request.HasTmdbId,
HasOverview = request.HasOverview,
HasOfficialRating = request.HasOfficialRating,
HasParentalRating = request.HasParentalRating,
HasSpecialFeature = request.HasSpecialFeature,
HasSubtitles = request.HasSubtitles,
HasThemeSong = request.HasThemeSong,
HasThemeVideo = request.HasThemeVideo,
HasTrailer = request.HasTrailer,
Tags = request.GetTags(),
OfficialRatings = request.GetOfficialRatings(),
Genres = request.GetGenres(),
Studios = request.GetStudios(),
StudioIds = request.GetStudioIds(),
Person = request.Person,
PersonIds = request.GetPersonIds(),
PersonTypes = request.GetPersonTypes(),
Years = request.GetYears(),
ImageTypes = request.GetImageTypes().ToArray(),
VideoTypes = request.GetVideoTypes().ToArray(),
AdjacentTo = request.AdjacentTo,
ItemIds = request.GetItemIds(),
MinPlayers = request.MinPlayers,
MaxPlayers = request.MaxPlayers,
MinCommunityRating = request.MinCommunityRating,
MinCriticRating = request.MinCriticRating,
ParentIndexNumber = request.ParentIndexNumber,
AiredDuringSeason = request.AiredDuringSeason,
AlbumArtistStartsWithOrGreater = request.AlbumArtistStartsWithOrGreater
};
if (!string.IsNullOrWhiteSpace(request.Ids))
{
query.CollapseBoxSetItems = false;
}
foreach (var filter in request.GetFilters())
{
switch (filter)
{
case ItemFilter.Dislikes:
query.IsLiked = false;
break;
case ItemFilter.IsFavorite:
query.IsFavorite = true;
break;
case ItemFilter.IsFavoriteOrLikes:
query.IsFavoriteOrLiked = true;
break;
case ItemFilter.IsFolder:
query.IsFolder = true;
break;
case ItemFilter.IsNotFolder:
query.IsFolder = false;
break;
case ItemFilter.IsPlayed:
query.IsPlayed = true;
break;
case ItemFilter.IsRecentlyAdded:
break;
case ItemFilter.IsResumable:
query.IsResumable = true;
break;
case ItemFilter.IsUnplayed:
query.IsPlayed = false;
//.........这里部分代码省略.........
开发者ID:paul-777,项目名称:Emby,代码行数:101,代码来源:ReportsService.cs
示例18: GetItemIds
public QueryResult<Guid> GetItemIds(InternalItemsQuery query)
{
if (query == null)
{
throw new ArgumentNullException("query");
}
CheckDisposed();
using (var cmd = _connection.CreateCommand())
{
cmd.CommandText = "select guid from TypedBaseItems";
var whereClauses = GetWhereClauses(query, cmd, false);
var whereTextWithoutPaging = whereClauses.Count == 0 ?
string.Empty :
" where " + string.Join(" AND ", whereClauses.ToArray());
whereClauses = GetWhereClauses(query, cmd, true);
var whereText = whereClauses.Count == 0 ?
string.Empty :
" where " + string.Join(" AND ", whereClauses.ToArray());
cmd.CommandText += whereText;
cmd.CommandText += GetOrderByText(query);
if (query.Limit.HasValue)
{
cmd.CommandText += " LIMIT " + query.Limit.Value.ToString(CultureInfo.InvariantCulture);
}
cmd.CommandText += "; select count (guid) from TypedBaseItems" + whereTextWithoutPaging;
var list = new List<Guid>();
var count = 0;
_logger.Debug(cmd.CommandText);
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
{
while (reader.Read())
{
list.Add(reader.GetGuid(0));
}
if (reader.NextResult() && reader.Read())
{
count = reader.GetInt32(0);
}
}
return new QueryResult<Guid>()
{
Items = list.ToArray(),
TotalRecordCount = count
};
}
}
开发者ID:RavenB,项目名称:Emby,代码行数:61,代码来源:SqliteItemRepository.cs
示例19: QueryRecursive
public QueryResult<BaseItem> QueryRecursive(InternalItemsQuery query)
{
var user = query.User;
if (RequiresPostFiltering(query))
{
IEnumerable<BaseItem> items;
Func<BaseItem, bool> filter = i => UserViewBuilder.Filter(i, user, query, UserDataManager, LibraryManager);
if (query.User == null)
{
items = GetRecursiveChildren(filter);
}
else
{
items = GetRecursiveChildren(user, filter);
}
return PostFilterAndSort(items, query);
}
if (!(this is UserRootFolder) && !(this is AggregateFolder))
{
query.ParentId = query.ParentId ?? Id;
}
return LibraryManager.GetItemsResult(query);
}
开发者ID:paul-777,项目名称:Emby,代码行数:28,代码来源:Folder.cs
示例20: GetItemIdsList
public List<Guid> GetItemIdsList(InternalItemsQuery query)
{
if (query == null)
{
throw new ArgumentNullException("query");
}
CheckDisposed();
using (var cmd = _connection.CreateCommand())
{
cmd.CommandText = "select guid from TypedBaseItems";
var whereClauses = GetWhereClauses(query, cmd, true);
var whereText = whereClauses.Count == 0 ?
string.Empty :
" where " + string.Join(" AND ", whereClauses.ToArray());
cmd.CommandText += whereText;
cmd.CommandText += GetOrderByText(query);
if (query.Limit.HasValue)
{
cmd.CommandText += " LIMIT " + query.Limit.Value.ToString(CultureInfo.InvariantCulture);
}
var list = new List<Guid>();
_logger.Debug(cmd.CommandText);
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
{
while (reader.Read())
{
list.Add(reader.GetGuid(0));
}
}
return list;
}
}
开发者ID:RavenB,项目名称:Emby,代码行数:43,代码来源:SqliteItemRepository.cs
注:本文中的MediaBrowser.Controller.Entities.InternalItemsQuery类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论