public async Task <TVDBResponse <EpisodeRecord> > GetAsync(int episodeId, CancellationToken cancellationToken = default)
        {
            var response = await GetJsonAsync <TVDBResponse <EpisodeRecord> >($"/episodes/{episodeId}", cancellationToken)
                           .ConfigureAwait(false);

            if (_options.ReturnCompleteUrlForImages && response.Data != null)
            {
                response.Data.Filename = ImageConverter.CheckAndConvertToCompleteUrl(response.Data.Filename);
            }

            return(response);
        }
Ejemplo n.º 2
0
        public async Task <TVDBResponse <Serie> > GetAsync(int seriesId, CancellationToken cancellationToken = default)
        {
            var response = await GetJsonAsync <TVDBResponse <Serie> >($"/series/{seriesId}").ConfigureAwait(false);

            if (_options.ReturnCompleteUrlForImages && response.Data != null)
            {
                response.Data.Banner = ImageConverter.CheckAndConvertToCompleteUrl(response.Data.Banner);
                response.Data.Poster = ImageConverter.CheckAndConvertToCompleteUrl(response.Data.Poster);
                response.Data.FanArt = ImageConverter.CheckAndConvertToCompleteUrl(response.Data.FanArt);
            }

            return(response);
        }
Ejemplo n.º 3
0
        public async Task <TVDBResponse <List <EpisodeRecord> > > GetEpisodesAsync(int seriesId, int page, CancellationToken cancellationToken = default)
        {
            var response = await GetJsonAsync <TVDBResponse <List <EpisodeRecord> > >($"/series/{seriesId}/episodes?page={Math.Max(page, 1)}", cancellationToken).ConfigureAwait(false);

            if (_options.ReturnCompleteUrlForImages && response.Data != null)
            {
                foreach (var episode in response.Data)
                {
                    episode.Filename = ImageConverter.CheckAndConvertToCompleteUrl(episode.Filename);
                }
            }

            return(response);
        }
Ejemplo n.º 4
0
        public async Task <TVDBResponse <List <Actor> > > GetActorsAsync(int seriesId, CancellationToken cancellationToken = default)
        {
            var response = await GetJsonAsync <TVDBResponse <List <Actor> > >($"/series/{seriesId}/actors", cancellationToken).ConfigureAwait(false);

            if (_options.ReturnCompleteUrlForImages && response.Data != null)
            {
                foreach (var actor in response.Data)
                {
                    actor.Image = ImageConverter.CheckAndConvertToCompleteUrl(actor.Image);
                }
            }

            return(response);
        }
Ejemplo n.º 5
0
        public async Task <TVDBResponse <List <Image> > > GetImagesAsync(int seriesId, ImagesQueryAlternative query, CancellationToken cancellationToken = default)
        {
            var response = await GetJsonAsync <TVDBResponse <List <Image> > >($"/series/{seriesId}/images/query?{query.ToQueryParams()}", cancellationToken).ConfigureAwait(false);

            if (_options.ReturnCompleteUrlForImages && response.Data != null)
            {
                foreach (var image in response.Data)
                {
                    image.FileName = ImageConverter.CheckAndConvertToCompleteUrl(image.FileName);
                }
            }

            return(response);
        }
        public async Task <TVDBResponse <List <SeriesSearchResult> > > SearchSeriesAsync(string value, string parameterKey, CancellationToken cancellationToken = default)
        {
            var url      = $"/search/series?{parameterKey.ToPascalCase()}={WebUtility.UrlEncode(value)}";
            var response = await GetJsonAsync <TVDBResponse <List <SeriesSearchResult> > >(url, cancellationToken).ConfigureAwait(false);

            if (_options.ReturnCompleteUrlForImages)
            {
                foreach (var result in response.Data)
                {
                    result.Image  = ImageConverter.CheckAndConvertToCompleteUrl(result.Image);
                    result.Poster = ImageConverter.CheckAndConvertToCompleteUrl(result.Poster);
                    result.Banner = ImageConverter.CheckAndConvertToCompleteUrl(result.Banner);
                }
            }

            return(response);
        }