• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Querying.ItemQuery类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MediaBrowser.Model.Querying.ItemQuery的典型用法代码示例。如果您正苦于以下问题:C# ItemQuery类的具体用法?C# ItemQuery怎么用?C# ItemQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ItemQuery类属于MediaBrowser.Model.Querying命名空间,在下文中一共展示了ItemQuery类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetItemsSection

        protected async Task<IItemDetailSection> GetItemsSection(ItemsResult itemsResult, Func<ItemsResult, bool> listCondition, bool expandSingleItem = true)
        {
            if (itemsResult.Items.Length == 1 && expandSingleItem && itemsResult.Items[0].IsFolder) {
                var query = new ItemQuery { ParentId = itemsResult.Items[0].Id, UserId = _sessionManager.CurrentUser.Id };
                return await GetItemsSection(await _apiClient.GetItemsAsync(query), listCondition);
            }

            if (listCondition(itemsResult)) {
                return new ItemsListViewModel(itemsResult, _apiClient, _imageManager, _serverEvents, _navigator, _playbackManager);
            }

            return new ItemsGridViewModel(itemsResult, _apiClient, _imageManager, _serverEvents, _navigator, _playbackManager);
        }
开发者ID:TomGillen,项目名称:MBT,代码行数:13,代码来源:BaseItemsListSectionGenerator.cs


示例2: GetMovies

        private Task<ItemsResult> GetMovies() 
        {
            var query = new ItemQuery {
                UserId = _sessionManager.CurrentUser.Id,
                IncludeItemTypes = new[] { "Movie" },
                SortBy = new[] { ItemSortBy.SortName },
                Fields = QueryFields,
                Recursive = true
            };

            return _apiClient.GetItemsAsync(query);
        }
开发者ID:TomGillen,项目名称:MBT,代码行数:12,代码来源:MovieSpotlightViewModel.cs


示例3: GetLatestUnwatched

        private async Task<bool> GetLatestUnwatched()
        {
            try
            {
                SetProgressBar("Getting latest unwatched items...");

                var query = new ItemQuery
                {
                    UserId = AuthenticationService.Current.LoggedInUser.Id,
                    SortBy = new[] {"DateCreated"},
                    SortOrder = SortOrder.Descending,
                    IncludeItemTypes = new[] {"Episode"},
                    Limit = 8,
                    Fields = new[] {ItemFields.PrimaryImageAspectRatio, ItemFields.ParentId},
                    Filters = new[] {ItemFilter.IsUnplayed},
                    Recursive = true
                };

                Log.Info("Getting next up items");

                var itemResponse = await _apiClient.GetItemsAsync(query);

                return SetLatestUnwatched(itemResponse);
            }
            catch (HttpException ex)
            {
                Log.ErrorException("GetLatestUnwatched()", ex);
            }

            SetProgressBar();

            return false;
        }
开发者ID:EchoDemon,项目名称:MediaBrowser.WindowsPhone,代码行数:33,代码来源:TvCollectionViewModel.cs


示例4: GetAllShows

        private Task<ItemsResult> GetAllShows(ItemListViewModel viewModel, DisplayPreferences displayPreferences)
        {
            var query = new ItemQuery
            {
                Fields = FolderPage.QueryFields,

                UserId = _sessionManager.CurrentUser.Id,

                IncludeItemTypes = new[] { "Series" },

                SortBy = !String.IsNullOrEmpty(displayPreferences.SortBy)
                             ? new[] { displayPreferences.SortBy }
                             : new[] { ItemSortBy.SortName },

                SortOrder = displayPreferences.SortOrder,

                Recursive = true
            };

            return ApiClient.GetItemsAsync(query, CancellationToken.None);
        }
开发者ID:Rainking720,项目名称:MediaBrowser.Theater,代码行数:21,代码来源:TvViewModel.cs


示例5: GetSoundtracks

        private Task<ItemsResult> GetSoundtracks(ItemListViewModel viewModel)
        {
            var item = ItemViewModel.Item;

            var query = new ItemQuery
            {
                UserId = _sessionManager.LocalUserId,
                Fields = new[]
                        {
                                 ItemFields.PrimaryImageAspectRatio,
                                 ItemFields.DateCreated
                        },
                Ids = item.SoundtrackIds,
                SortBy = new[] { ItemSortBy.SortName }
            };

            return _apiClient.GetItemsAsync(query, CancellationToken.None);
        }
开发者ID:chandum2,项目名称:Emby.Theater,代码行数:18,代码来源:DetailPageViewModel.cs


示例6: RetrieveMusicGenres

        public IEnumerable<BaseItem> RetrieveMusicGenres(ItemQuery query)
        {
            var dtos = Kernel.ApiClient.GetMusicGenres(query);

            return dtos == null ? new BaseItem[] {} : dtos.Items.Select(dto => GetItem(dto, dto.Type)).Where(item => item != null);
            
        }
开发者ID:Ceten,项目名称:MediaBrowser.Classic,代码行数:7,代码来源:MB3ApiRepository.cs


示例7: GetAlbums

        private async Task<bool> GetAlbums()
        {
            try
            {
                var query = new ItemQuery
                {
                    UserId = AuthenticationService.Current.LoggedInUser.Id,
                    Artists = new[] {SelectedArtist.Name},
                    Recursive = true,
                    Fields = new[] { ItemFields.ParentId,},
                    IncludeItemTypes = new[] {"MusicAlbum"}
                };

                Log.Info("Getting albums for artist [{0}] ({1})", SelectedArtist.Name, SelectedArtist.Id);

                var items = await _apiClient.GetItemsAsync(query);
                if (items != null && items.Items.Any())
                {
                    //// Extract the album items from the results
                    //var albums = items.Items.Where(x => x.Type == "MusicAlbum").ToList();

                    //// Extract the track items from the results
                    //_artistTracks = items.Items.Where(y => y.Type == "Audio").ToList();

                    //var nameId = (from a in _artistTracks
                    //              select new KeyValuePair<string, string>(a.Album, a.ParentId)).Distinct();

                    //// This sets the album names correctly based on what's in the track information (rather than folder name)
                    //foreach (var ni in nameId)
                    //{
                    //    var item = albums.SingleOrDefault(x => x.Id == ni.Value);
                    //    item.Name = ni.Key;
                    //}

                    foreach (var album in items.Items)
                    {
                        Albums.Add(album);
                    }
                    return true;
                }
                return false;
            }
            catch (Exception ex)
            {
                Log.ErrorException("GetAlbums()", ex);
                return false;
            }
        }
开发者ID:EchoDemon,项目名称:MediaBrowser.WindowsPhone,代码行数:48,代码来源:MusicViewModel.cs


示例8: GetAlbumTracks

        private async Task GetAlbumTracks()
        {
            try
            {
                var query = new ItemQuery
                {
                    ParentId = SelectedAlbum.Id,
                    IncludeItemTypes = new[] { "Audio" },
                    UserId = AuthenticationService.Current.LoggedInUserId
                };

                var tracks = await _apiClient.GetItemsAsync(query);

                if (tracks.Items.IsNullOrEmpty())
                {
                    return;
                }

                AlbumTracks = tracks.Items.OrderBy(x => x.ParentIndexNumber)
                                          .ThenBy(x => x.IndexNumber).ToList();
            }
            catch (HttpException ex)
            {
                Log.ErrorException("GetAlbumTracks()", ex);
            }
        }
开发者ID:EchoDemon,项目名称:MediaBrowser.WindowsPhone,代码行数:26,代码来源:MusicViewModel.cs


示例9: GetCollectionItems

        private async Task<ItemsResult> GetCollectionItems(int limit)
        {
            var query = new ItemQuery
            {
                IncludeItemTypes = new[] {"Season", "Series", "Movie"},
                Limit = limit,
                SortBy = new[] {ItemSortBy.Random},
                UserId = AuthenticationService.Current.LoggedInUserId,
                ImageTypes = new []{ImageType.Primary},
                Recursive = true
            };

            if (!string.IsNullOrEmpty(CollectionId))
            {
                query.ParentId = CollectionId;
            }

            var itemResponse = await _connectionManager.GetApiClient(App.ServerInfo.Id).GetItemsAsync(query);
            return itemResponse;
        }
开发者ID:gep13,项目名称:Emby.WindowsPhone,代码行数:20,代码来源:LockScreenService.cs


示例10: GetLatestEpisodes

        private async Task<ItemsResult> GetLatestEpisodes(ItemListViewModel viewModel)
        {
            var query = new ItemQuery
            {
                Fields = new[]
                        {
                            ItemFields.PrimaryImageAspectRatio,
                            ItemFields.DateCreated,
                            ItemFields.DisplayPreferencesId
                        },

                UserId = _sessionManager.CurrentUser.Id,

                SortBy = new[] { ItemSortBy.DateCreated },

                SortOrder = SortOrder.Descending,

                IncludeItemTypes = new[] { "Episode" },

                ExcludeLocationTypes = new[] { LocationType.Virtual },

                Filters = new[] { ItemFilter.IsUnplayed },

                Limit = 9,

                Recursive = true
            };

            var result = await ApiClient.GetItemsAsync(query);

            ShowLatestEpisodes = result.TotalRecordCount > 0;

            return result;
        }
开发者ID:jfrankelp,项目名称:MediaBrowser.Theater,代码行数:34,代码来源:TvViewModel.cs


示例11: GetRecentlyPlayedAsync

        private async Task<ItemsResult> GetRecentlyPlayedAsync(ItemListViewModel viewModel)
        {
            var query = new ItemQuery
            {
                Fields = new[]
                        {
                            ItemFields.PrimaryImageAspectRatio,
                            ItemFields.DateCreated,
                            ItemFields.DisplayPreferencesId
                        },

                UserId = _sessionManager.CurrentUser.Id,

                SortBy = new[] { ItemSortBy.DatePlayed },

                SortOrder = SortOrder.Descending,

                Filters = new[] { ItemFilter.IsPlayed },

                IncludeItemTypes = new[] { "Game" },

                Recursive = true,

                Limit = 6
            };

            var result = await ApiClient.GetItemsAsync(query);

            ShowRecentlyPlayed = result.Items.Length > 0;

            return result;
        }
开发者ID:jfrankelp,项目名称:MediaBrowser.Theater,代码行数:32,代码来源:GamesViewModel.cs


示例12: GetGameSystems

        private Task<ItemsResult> GetGameSystems(ItemListViewModel viewModel)
        {
            var query = new ItemQuery
            {
                Fields = new[]
                        {
                            ItemFields.PrimaryImageAspectRatio,
                            ItemFields.DateCreated,
                            ItemFields.DisplayPreferencesId
                        },

                UserId = _sessionManager.CurrentUser.Id,

                SortBy = new[] { ItemSortBy.SortName },

                IncludeItemTypes = new[] { "GameSystem" },

                Recursive = true
            };

            return ApiClient.GetItemsAsync(query);
        }
开发者ID:jfrankelp,项目名称:MediaBrowser.Theater,代码行数:22,代码来源:GamesViewModel.cs


示例13: GetLatestUnwatched

        private async Task<bool> GetLatestUnwatched()
        {
            try
            {
                SetProgressBar(AppResources.SysTrayGettingUnwatchedItems);

                var query = new ItemQuery
                {
                    UserId = AuthenticationService.Current.LoggedInUserId,
                    SortBy = new[] {"DateCreated"},
                    SortOrder = SortOrder.Descending,
                    IncludeItemTypes = new[] {"Movie"},
                    Limit = 9,
                    Fields = new[] {ItemFields.PrimaryImageAspectRatio},
                    Filters = new[] {ItemFilter.IsUnplayed},
                    Recursive = true,
                    ImageTypeLimit = 1,
                    EnableImageTypes = new[] { ImageType.Backdrop, ImageType.Primary, }
                };

                Log.Info("Getting next up items");

                var itemResponse = await ApiClient.GetItemsAsync(query);

                return SetLatestUnwatched(itemResponse);
            }
            catch (HttpException ex)
            {
                Utils.HandleHttpException("GetLatestUnwatched()", ex, NavigationService, Log);
            }

            SetProgressBar();

            return false;
        }
开发者ID:zardaloop,项目名称:Emby.WindowsPhone,代码行数:35,代码来源:MovieCollectionViewModel.cs


示例14: GetBoxsets

        private async Task<bool> GetBoxsets()
        {
            try
            {
                SetProgressBar(AppResources.SysTrayGettingBoxsets);

                var query = new ItemQuery
                {
                    UserId = AuthenticationService.Current.LoggedInUserId,
                    SortBy = new[] {"SortName"},
                    SortOrder = SortOrder.Ascending,
                    IncludeItemTypes = new[] {"BoxSet"},
                    Recursive = true,
                    ImageTypeLimit = 1,
                    EnableImageTypes = new[] { ImageType.Backdrop, ImageType.Primary, }
                };

                var itemResponse = await ApiClient.GetItemsAsync(query);
                return await SetBoxsets(itemResponse);
            }
            catch (HttpException ex)
            {
                Utils.HandleHttpException("GetBoxsets()", ex, NavigationService, Log);
            }

            SetProgressBar();

            return false;
        }
开发者ID:zardaloop,项目名称:Emby.WindowsPhone,代码行数:29,代码来源:MovieCollectionViewModel.cs


示例15: GetItems

        private async Task<bool> GetItems()
        {
            try
            {
                var query = new ItemQuery
                {
                    UserId = AuthenticationService.Current.LoggedInUserId,
                    SortBy = new[] {ItemSortBy.SortName},
                    SortOrder = SortOrder.Ascending,
                    Fields = new[]
                    {
                        ItemFields.SortName,
                        ItemFields.Genres,
                        ItemFields.ProviderIds,
                        ItemFields.ParentId,
                        ItemFields.CumulativeRunTimeTicks
                    },
                    ExcludeItemTypes = SelectedFolder != null && SelectedFolder.Name.ToLower().Contains("recent") ? new[] {"Season", "Series"} : null,
                    ImageTypeLimit = 1,
                    EnableImageTypes = new[] { ImageType.Backdrop, ImageType.Primary, }
                };
                var isRecent = false;
                if (SelectedPerson != null)
                {
                    Log.Info("Getting items for {0}", SelectedPerson.Name);
                    PageTitle = SelectedPerson.Name.ToLower();
                    query.Person = SelectedPerson.Name;
                    query.PersonTypes = new[] {SelectedPerson.Type};
                    query.Recursive = true;
                }
                else
                {
                    if (SelectedFolder.Name.Contains(AppResources.LabelRecent.ToLower()))
                    {
                        Log.Info("Getting recent items");
                        PageTitle = AppResources.LabelRecent.ToLower();
                        query = Utils.GetRecentItemsQuery(excludedItemTypes: new[] {"Photo", "Season", "Series"});
                        isRecent = true;
                    }
                    else if (SelectedFolder.Name.Equals(AppResources.Favourites.ToLower()))
                    {
                        Log.Info("Getting favourite items");
                        PageTitle = AppResources.Favourites.ToLower();
                        query.Filters = new[] {ItemFilter.IsFavorite};
                        query.Recursive = true;
                    }
                    else if (SelectedFolder.Type.StartsWith(AppResources.Genre))
                    {
                        Log.Info("Getting items for genre [{0}]", SelectedFolder.Name);
                        PageTitle = SelectedFolder.Name.ToLower();
                        query.Genres = new[] {SelectedFolder.Name};
                        query.Recursive = true;

                        if (SelectedFolder.Type.Contains(" - " + AppResources.LabelTv.ToUpper()))
                        {
                            query.IncludeItemTypes = new[] {"Series"};
                        }
                        else if (SelectedFolder.Type.Contains(" - " + AppResources.LabelMovies.ToUpper()))
                        {
                            query.ExcludeItemTypes = new[] { "Series" };
                            query.IncludeItemTypes = new[] {"Movie", "Trailer"};
                        }
                    }
                    else
                    {
                        Log.Info("Getting items for folder [{0}]", SelectedFolder.Name);
                        PageTitle = SelectedFolder.Name.ToLower();
                        query.ParentId = SelectedFolder.Id;
                    }
                }
                var items = await ApiClient.GetItemsAsync(query);
                
                CurrentItems = isRecent ? await Utils.SortRecentItems(items.Items, App.SpecificSettings.IncludeTrailersInRecent) : items.Items.ToList();
                return true;
            }
            catch (HttpException ex)
            {
                Utils.HandleHttpException("GetItems()", ex, NavigationService, Log);

                App.ShowMessage(AppResources.ErrorGettingData);
                return false;
            }
        }
开发者ID:zardaloop,项目名称:Emby.WindowsPhone,代码行数:83,代码来源:FolderViewModel.cs


示例16: GetComedyMovies

        private Task<ItemsResult> GetComedyMovies(ItemListViewModel viewModel, DisplayPreferences displayPreferences)
        {
            var query = new ItemQuery
            {
                Fields = FolderPage.QueryFields,

                UserId = _sessionManager.CurrentUser.Id,

                IncludeItemTypes = new[] { "Movie" },

                Genres = new[] { ApiClientExtensions.ComedyGenre },

                SortBy = !String.IsNullOrEmpty(displayPreferences.SortBy)
                             ? new[] { displayPreferences.SortBy }
                             : new[] { ItemSortBy.SortName },

                SortOrder = displayPreferences.SortOrder,

                Recursive = true
            };

            return ApiClient.GetItemsAsync(query);
        }
开发者ID:jfrankelp,项目名称:MediaBrowser.Theater,代码行数:23,代码来源:MoviesViewModel.cs


示例17: GeSearchPeopleAsync

        private async Task<Boolean> GeSearchPeopleAsync()
        {
            SearchHintResult searchHintResult = await _apiClient.GetSearchHintsAsync(new SearchQuery { UserId = _apiClient.CurrentUserId, SearchTerm = CurrentSearch, IncludePeople = true, IncludeArtists = false, IncludeGenres = false, IncludeMedia = false, IncludeStudios = false, Limit = 9 });

            var ids = (searchHintResult.TotalRecordCount > 0) ? searchHintResult.SearchHints.Select(s => s.ItemId).ToArray() : null;
            if (ids != null && ids.Length > 0)
            {
                var query = new ItemQuery
                {
                    Ids = ids,
                    UserId = _apiClient.CurrentUserId,
                    Fields = FolderPage.QueryFields
                };

                _searchedPeopleItemsResult = await _apiClient.GetItemsAsync(query);
            }
            else
            {
                _searchedPeopleItemsResult = _emptyItemsResult;
            }

            return true;
        }
开发者ID:razorzedge,项目名称:MediaBrowser.Theater,代码行数:23,代码来源:SearchViewModel.cs


示例18: NavigateToPerson

        void NavigateToPerson(string name, string[] personTypes)
        {
            Async.Queue(Async.ThreadPoolName.PersonNavigation, () =>
                                                 {
                                                    ProgressBox(string.Format("Finding items with {0} in them...", name));
                                                    
                                                    var person = Kernel.Instance.MB3ApiRepository.RetrievePerson(name) ?? new Person();

                                                    var query = new ItemQuery
                                                                    {
                                                                        UserId = Kernel.CurrentUser.Id.ToString(),
                                                                        Fields = MB3ApiRepository.StandardFields,
                                                                        PersonIds = new [] {person.ApiId},
                                                                        PersonTypes = personTypes,
                                                                        Recursive = true
                                                                    };

                                                    var index = new SearchResultFolder(Kernel.Instance.MB3ApiRepository.RetrieveItems(query).ToList()) {Name = name, Overview = person.Overview};
                                                    ShowMessage = false;

                                                    Application.UIDeferredInvokeIfRequired(() => Navigate(ItemFactory.Instance.Create(index)));
                                                     
                                                 });
            
        }
开发者ID:softworkz,项目名称:MediaBrowser.Classic,代码行数:25,代码来源:Application.cs


示例19: GetArtistTracks

        private async Task<bool> GetArtistTracks()
        {
            try
            {
                var query = new ItemQuery
                {
                    UserId = AuthenticationService.Current.LoggedInUser.Id,
                    Artists = new[] {SelectedArtist.Name},
                    Recursive = true,
                    Fields = new[] { ItemFields.ParentId,},
                    IncludeItemTypes = new[] {"Audio"}
                };

                Log.Info("Getting tracks for artist [{0}] ({1})", SelectedArtist.Name, SelectedArtist.Id);

                var items = await _apiClient.GetItemsAsync(query);

                if (items != null && items.Items.Any())
                {
                    _artistTracks = items.Items.ToList();
                }

                return true;
            }
            catch (HttpException ex)
            {
                Log.ErrorException("GetArtistTracks()", ex);
                return false;
            }
        }
开发者ID:EchoDemon,项目名称:MediaBrowser.WindowsPhone,代码行数:30,代码来源:MusicViewModel.cs


示例20: NavigateToGenre

        public void NavigateToGenre(string genre, Item currentMovie, string itemType)
        {
            switch (currentMovie.BaseItem.GetType().Name)
            {
                case "Series":
                case "Season":
                case "Episode":
                    itemType = "Series";
                    break;

                case "MusicAlbum":
                case "MusicArtist":
                case "MusicGenre":
                case "Song":
                    itemType = "MusicAlbum";
                    break;

                case "Game":
                    itemType = "Game";
                    break;
            }

            Async.Queue(Async.ThreadPoolName.GenreNavigation, () =>
                                                {
                                                    ProgressBox(string.Format("Finding items in the {0} genre...", genre));
                                                    var searchStart = GetStartingFolder(currentMovie.BaseItem.Parent);

                                                    var query = new ItemQuery
                                                                    {
                                                                        UserId = Kernel.CurrentUser.Id.ToString(),
                                                                        Fields = MB3ApiRepository.StandardFields,
                                                                        ParentId = searchStart.ApiId,
                                                                        Genres = new[] {genre},
                                                                        IncludeItemTypes = new [] {itemType},
                                                                        Recursive = true
                                                                    };
                                                    var index = new SearchResultFolder(Kernel.Instance.MB3ApiRepository.RetrieveItems(query).ToList()) {Name = genre};
                                                    ShowMessage = false;

                                                    Navigate(ItemFactory.Instance.Create(index));
                                                });
        }
开发者ID:softworkz,项目名称:MediaBrowser.Classic,代码行数:42,代码来源:Application.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Sync.SyncTarget类代码示例发布时间:2022-05-26
下一篇:
C# LiveTv.TunerHostInfo类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap