当前位置: 首页>>代码示例>>C#>>正文


C# Entities.InternalItemsQuery类代码示例

本文整理汇总了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);
        }
开发者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


注:本文中的MediaBrowser.Controller.Entities.InternalItemsQuery类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。