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


C# Querying.ItemQuery类代码示例

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


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


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