Example #1
0
            public async Task <bool> GetDetailsAsync(CancellationToken ct)
            {
                if (Populated)
                {
                    return(true);
                }

                var response = await ParentConcrete.GetResponseJSONObjectAsync <MovieInfo>($"movie/{ID}", string.Empty, ct);

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

                var imgResponse = await ParentConcrete.Client.GetAsync(CoverArtUri, ct);

                if (ct.IsCancellationRequested || !imgResponse.IsSuccessStatusCode)
                {
                    return(false);
                }

                Description = response.Description;
                GenreInfos  = response.GenreInfos;
                Genres      = ParentConcrete.GetGenreNames(GenreInfos);
                var imageBytes = await imgResponse.Content.ReadAsByteArrayAsync();

                Image     = new MemoryStreamProvider(imageBytes);
                Populated = true;
                return(true);
            }
Example #2
0
            public async Task <bool> GetDetailsAsync(CancellationToken ct)
            {
                if (Populated)
                {
                    return(true);
                }

                var config = await ParentConcrete.GetConfigurationAsync(ct);

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

                var response = await ParentConcrete.GetResponseJSONObjectAsync <TVShowInfo>($"tv/{ID}", string.Empty, ct);

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

                Description = response.Description;
                GenreInfos  = response.GenreInfos;
                Genres      = ParentConcrete.GetGenreNames(GenreInfos);
                Seasons     = response.Seasons;
                foreach (var i in Seasons)
                {
                    i.ParentConcrete = this;
                    i.CoverArtUri    = ParentConcrete.GetAbsoluteCoverImageUri(i.CoverArtUri, config);
                }

                var imgResponse = await ParentConcrete.Client.GetAsync(CoverArtUri, ct);

                if (ct.IsCancellationRequested || !imgResponse.IsSuccessStatusCode)
                {
                    return(false);
                }

                var imageBytes = await imgResponse.Content.ReadAsByteArrayAsync();

                Image = new MemoryStreamProvider(imageBytes);

                Populated = true;
                return(true);
            }