/// <summary> /// Finds the images. /// </summary> /// <param name="movieId">The movie identifier.</param> /// <returns></returns> public async Task <AvailableMovieImages> FindImages(string movieId) { string url = string.Format("3/movie/{0}/images?api_key={1}", movieId, MovieHelper.ThemoviedbApiKey); MovieImagesResult result = await _restApiService.Get <MovieImagesResult>(url); return(await ConvertImagesResult(result)); }
private async Task <AvailableMovieImages> ConvertImagesResult(MovieImagesResult movieImagesResult) { AvailableMovieImages availableMovieImages = new AvailableMovieImages(); availableMovieImages.Fanarts = await ConvertImagesCollection(movieImagesResult.Backdrops, 1920, 1080); availableMovieImages.Posters = await ConvertImagesCollection(movieImagesResult.Posters, 680, 1000); return(availableMovieImages); }
/// <summary> /// Finds the set images. /// </summary> /// <param name="setName">Name of the set.</param> /// <returns></returns> public async Task <AvailableMovieImages> FindSetImages(string setName) { // TODO: refactor string searchCollectionUrl = string.Format("3/search/collection?query={0}&api_key={1}", setName, MovieHelper.ThemoviedbApiKey); SearchCollectionResult searchResult = await _restApiService.Get <SearchCollectionResult>(searchCollectionUrl); MovieSet set = searchResult.Results.FirstOrDefault(); if (set != null) { string getCollectionImagesUrl = string.Format("3/collection/{0}/images?api_key={1}", set.Id, MovieHelper.ThemoviedbApiKey); MovieImagesResult getImagesResult = await _restApiService.Get <MovieImagesResult>(getCollectionImagesUrl); return(await ConvertImagesResult(getImagesResult)); } return(new AvailableMovieImages()); }