コード例 #1
0
        private async Task <bool> GetArtists()
        {
            var query = new ArtistsQuery
            {
                SortBy    = new [] { "SortName" },
                SortOrder = SortOrder.Ascending,
                Recursive = true,
                UserId    = AuthenticationService.Current.LoggedInUser.Id
            };

            try
            {
                var itemsResponse = await _apiClient.GetArtistsAsync(query);

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

                var items = itemsResponse.Items.ToList();

                Artists = await Utils.GroupItemsByName(items);

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

            return(false);
        }
コード例 #2
0
        private Task <ItemsResult> GetFavoriteArtists(ItemListViewModel viewModel, DisplayPreferences displayPreferences)
        {
            var query = new ArtistsQuery
            {
                Fields = FolderPage.QueryFields,

                UserId = _sessionManager.CurrentUser.Id,

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

                SortOrder = displayPreferences.SortOrder,

                Recursive = true,

                Filters = new[] { ItemFilter.IsFavorite }
            };

            return(ApiClient.GetArtistsAsync(query));
        }
コード例 #3
0
        private async Task GetArtistInfo()
        {
            try
            {
                Log.Info("Getting information for Artist [{0}] ({1})", SelectedArtist.Name, SelectedArtist.Id);

                var artistQuery = new ArtistsQuery
                {
                };
                SelectedArtist = await _apiClient.GetItemAsync(SelectedArtist.Id, AuthenticationService.Current.LoggedInUser.Id);
            }
            catch (HttpException ex)
            {
                Log.ErrorException("GetArtistInfo()", ex);
            }

            _gotAlbums = await GetAlbums();

            await GetArtistTracks();

            await SortTracks();
        }
コード例 #4
0
        private async Task <bool> GetArtists()
        {
            var query = new ArtistsQuery
            {
                ParentId         = _parentId,
                SortBy           = new[] { "SortName" },
                Fields           = new[] { ItemFields.SortName, ItemFields.MediaSources, ItemFields.SyncInfo, },
                SortOrder        = SortOrder.Ascending,
                Recursive        = true,
                UserId           = AuthenticationService.Current.LoggedInUserId,
                ImageTypeLimit   = 1,
                EnableImageTypes = new[] { ImageType.Backdrop, ImageType.Primary, }
            };

            try
            {
                var itemsResponse = await ApiClient.GetAlbumArtistsAsync(query);

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

                var items = itemsResponse.Items.ToList();

                Artists = await Utils.GroupItemsByName(items);

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

            return(false);
        }
コード例 #5
0
        private async Task GetArtistInfo()
        {
            try
            {
                Log.Info("Getting information for Artist [{0}] ({1})", SelectedArtist.Name, SelectedArtist.Id);

                var artistQuery = new ArtistsQuery
                {

                };
                SelectedArtist = await _apiClient.GetItemAsync(SelectedArtist.Id, AuthenticationService.Current.LoggedInUser.Id);
            }
            catch (HttpException ex)
            {
                Log.ErrorException("GetArtistInfo()", ex);
            }

            _gotAlbums = await GetAlbums();

            await GetArtistTracks();

            await SortTracks();
        }
コード例 #6
0
        private async Task<bool> GetArtists()
        {
            var query = new ArtistsQuery
            {
                SortBy = new []{"SortName"},
                SortOrder = SortOrder.Ascending,
                Recursive = true,
                UserId = AuthenticationService.Current.LoggedInUser.Id
            };

            try
            {
                var itemsResponse = await _apiClient.GetArtistsAsync(query);

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

                var items = itemsResponse.Items.ToList();

                Artists = await Utils.GroupItemsByName(items);

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

            return false;
        }
コード例 #7
0
        private async Task<bool> GetArtists()
        {
            var query = new ArtistsQuery
            {
                SortBy = new[] {"SortName"},
                Fields = new[] {ItemFields.SortName, ItemFields.MediaSources},
                SortOrder = SortOrder.Ascending,
                Recursive = true,
                UserId = AuthenticationService.Current.LoggedInUserId,
                ImageTypeLimit = 1,
                EnableImageTypes = new[] {ImageType.Backdrop, ImageType.Primary,}
            };

            try
            {
                var itemsResponse = await ApiClient.GetAlbumArtistsAsync(query);

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

                var items = itemsResponse.Items.ToList();

                Artists = await Utils.GroupItemsByName(items);

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

            return false;
        }
コード例 #8
0
        private Task<ItemsResult> GetFavoriteArtists(ItemListViewModel viewModel, DisplayPreferences displayPreferences)
        {
            var query = new ArtistsQuery
            {
                Fields = FolderPage.QueryFields,

                UserId = _sessionManager.CurrentUser.Id,

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

                SortOrder = displayPreferences.SortOrder,

                Recursive = true,

                Filters = new[] { ItemFilter.IsFavorite }
            };

            return ApiClient.GetArtistsAsync(query);
        }