public async Task <IEnumerable <string> > FindArtistImages(string id)
        {
            string            url    = string.Format("/v3/music/{0}?api_key={1}", id, MusicHelper.FanartTvApiKey);
            ArtistImagesQuery images = await _restApiService.Get <ArtistImagesQuery>(url);

            return(images.ArtistBackground.Select(artistBackground => artistBackground.Url));
        }
Exemplo n.º 2
0
        public async Task <IEnumerable <Series> > FindSeries(string name)
        {
            string        url    = string.Format("api/GetSeries.php?seriesname={0}&language=en", HttpUtility.UrlEncode(name));
            List <Series> series = await _restApiService.Get <List <Series> >(url);

            FixSeriesUrl(series);
            return(series);
        }
Exemplo n.º 3
0
        public async Task <PagedList <ArtistSummary> > FindArtists(string name, int page, int pageSize)
        {
            int    offset = page * pageSize;
            string url    = string.Format("/ws/2/artist?query={0}&offset={1}&limit={2}", HttpUtility.UrlEncode(name), offset, pageSize);
            string result = await _restApiService.Get(url);

            ArtistQueryMetadata metadata = DeserializeArtistQueryMetadata(result);

            return(new PagedList <ArtistSummary>(metadata.Collection, page, pageSize, metadata.Collection.TotalCount));
        }
Exemplo n.º 4
0
        public async Task <int> GetWoeIdByLocationName(string locationName)
        {
            var locationUrl = $"{hostUrl}/location/search/?query={locationName}";
            var locations   = await restApiService.Get <List <LocationDto> >(locationUrl);

            var location = locations?.FirstOrDefault();

            if (location == null)
            {
                throw new OperationCanceledException("Location not found");
            }

            return(location.WoeId);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Gets the synopsis.
        /// </summary>
        /// <param name="movieId">The movie identifier.</param>
        /// <returns></returns>
        public async Task <MovieSynopsis> GetSynopsis(string movieId)
        {
            string url = string.Format("title/{0}/", movieId);
            string moviePageContent = await _restApiService.Get(url);

            return(ParseMoviePageContent(moviePageContent));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Finds the movies.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public async Task <IEnumerable <Movie> > FindMovies(string name)
        {
            string url = string.Format("3/search/movie?api_key={0}&query={1}",
                                       MovieHelper.ThemoviedbApiKey,
                                       HttpUtility.UrlEncode(name));
            SearchMovieResult result = await _restApiService.Get <SearchMovieResult>(url);

            await FixImagesUrl(result.Results);

            return(result.Results);
        }