private async Task<bool> GetGenres()
        {
            try
            {
                SetProgressBar("Getting genres...");

                var query = new ItemsByNameQuery
                {
                    SortBy = new[] { "SortName" },
                    SortOrder = SortOrder.Ascending,
                    IncludeItemTypes = new[] { "Series" },
                    Recursive = true,
                    Fields = new[] { ItemFields.DateCreated },
                    UserId = AuthenticationService.Current.LoggedInUser.Id
                };

                var items = await _apiClient.GetGenresAsync(query);

                if (!items.Items.IsNullOrEmpty())
                {
                    var genres = items.Items.ToList();
                    genres.ForEach(genre => genre.Type = "Genre - TV");

                    Genres = genres;

                    SetProgressBar();

                    return true;
                }
            }
            catch (HttpException ex)
            {
                Log.ErrorException("GetGenres()", ex);
            }

            SetProgressBar();

            return false;
        }
Ejemplo n.º 2
0
        public IEnumerable<BaseItem> RetrieveMusicArtists(ItemsByNameQuery query)
        {
            var dtos = Kernel.ApiClient.GetArtists(query);

            return dtos == null ? new BaseItem[] {} : dtos.Items.Select(dto => GetItem(dto, dto.Type)).Where(item => item != null);
            
        }
Ejemplo n.º 3
0
        public IEnumerable<BaseItem> RetrieveIbnItems(string ibnName, ItemsByNameQuery query)
        {
            var dtos = Kernel.ApiClient.GetIbnItems(ibnName, query);

            return dtos == null ? new BaseItem[] {} : dtos.Items.Select(dto => GetItem(dto, dto.Type)).Where(item => item != null);
            
        }
        private async Task<bool> GetGenres()
        {
            try
            {
                SetProgressBar(AppResources.SysTrayGettingGenres);

                var query = new ItemsByNameQuery
                {
                    SortBy = new[] { "SortName" },
                    SortOrder = SortOrder.Ascending,
                    IncludeItemTypes = new[] { "Movie", "Trailer" },
                    Recursive = true,
                    Fields = new[] { ItemFields.DateCreated },
                    UserId = AuthenticationService.Current.LoggedInUserId,
                    ImageTypeLimit = 1,
                    EnableImageTypes = new[] { ImageType.Backdrop, ImageType.Primary, }
                };

                var items = await ApiClient.GetGenresAsync(query);

                if (!items.Items.IsNullOrEmpty())
                {
                    var genres = items.Items.ToList();
                    genres.ForEach(genre => genre.Type = "Genre - " + AppResources.LabelMovies.ToUpper());

                    Genres = genres;

                    SetProgressBar();

                    return true;
                }
            }
            catch (HttpException ex)
            {
                Utils.HandleHttpException("GetGenres()", ex, NavigationService, Log);
            }

            SetProgressBar();

            return false;
        }
        private async Task<bool> GetGenres()
        {
            var query = new ItemsByNameQuery
            {
                SortBy = new[] { "SortName" },
                SortOrder = SortOrder.Ascending,
                IncludeItemTypes = new[] { "Audio", "MusicVideo" },
                Recursive = true,
                Fields = new[] {  ItemFields.DateCreated },
                UserId = AuthenticationService.Current.LoggedInUser.Id
            };

            try
            {
                var genresResponse = await _apiClient.GetGenresAsync(query);

                if (genresResponse == null)
                {
                    return false;
                }

                Genres = genresResponse.Items.ToList();

                return true;
            }
            catch (HttpException ex)
            {
                Log.ErrorException("GetGenres()", ex);
            }

            return false;
        }
        private async Task<bool> GetGenres()
        {
            var query = new ItemsByNameQuery
            {
                SortBy = new[] { "SortName" },
                SortOrder = SortOrder.Ascending,
                IncludeItemTypes = new[] { "Audio", "MusicVideo" },
                Recursive = true,
                Fields = new[] {  ItemFields.DateCreated, ItemFields.MediaSources },
                UserId = AuthenticationService.Current.LoggedInUserId,
                ImageTypeLimit = 1,
                EnableImageTypes = new[] { ImageType.Backdrop, ImageType.Primary, }
            };

            try
            {
                var genresResponse = await ApiClient.GetGenresAsync(query);

                if (genresResponse == null)
                {
                    return false;
                }

                Genres = genresResponse.Items.ToList();

                return true;
            }
            catch (HttpException ex)
            {
                Utils.HandleHttpException("GetGenres()", ex, NavigationService, Log);
            }

            return false;
        }