Beispiel #1
0
 public static void PopulateGenres(this IEnumerable <TVShowInfo> tvShows, IApiGenreRequest api)
 {
     foreach (TVShowInfo tvShow in tvShows)
     {
         tvShow.Genres = MapGenreIdsToGenres(tvShow.GenreIds, api);
     }
 }
Beispiel #2
0
 public static void PopulateGenres(this IEnumerable <MovieInfo> movies, IApiGenreRequest api)
 {
     foreach (MovieInfo movie in movies)
     {
         movie.Genres = MapGenreIdsToGenres(movie.GenreIds, api);
     }
 }
        public void TestInit()
        {
            ApiResponseUtil.ThrottleTests();

            _api = MovieDbFactory.Create<IApiGenreRequest>().Value;

            Assert.IsInstanceOfType( _api, typeof( ApiGenreRequest ) );
        }
Beispiel #4
0
 public static void PopulateGenres(this IEnumerable <PersonInfo> people, IApiGenreRequest api)
 {
     foreach (PersonInfo person in people)
     {
         foreach (PersonInfoRole role in person.KnownFor)
         {
             role.Genres = MapGenreIdsToGenres(role.GenreIds, api);
         }
     }
 }
        public void TestInit()
        {
            ApiResponseUtil.ThrottleTests();

            _api = MovieDbFactory.Create <IApiGenreRequest>().Value;

            Assert.IsInstanceOfType(_api, typeof(ApiGenreRequest));

            (( ApiGenreRequest )_api).ClearAllGenres();
        }
Beispiel #6
0
        private static Genre MapGenre(int genreId, IApiGenreRequest api)
        {
            Genre genre = api.AllGenres.FirstOrDefault(x => x.Id == genreId);

            if (genre == null)
            {
                genre = Task.Run(() => api.FindByIdAsync(genreId)).GetAwaiter().GetResult().Item;
            }

            return(genre);
        }
Beispiel #7
0
 public ApiPeopleRequest(IMovieDbSettings settings, IApiGenreRequest genreApi)
     : base(settings)
 {
     _genreApi = genreApi;
 }
Beispiel #8
0
 public ApiMovieRequest(IMovieDbSettings settings, IApiGenreRequest genreApi)
     : base(settings)
 {
     _genreApi = genreApi;
     _settings = settings;
 }
Beispiel #9
0
        private static IReadOnlyList <Genre> MapGenreIdsToGenres(IEnumerable <int> genreIds, IApiGenreRequest api)
        {
            IReadOnlyList <Genre> genres = genreIds
                                           .Select(x => MapGenre(x, api))
                                           .ToList()
                                           .AsReadOnly();

            return(genres);
        }
 public ApiCompanyRequest( IMovieDbSettings settings, IApiGenreRequest genreApi )
     : base( settings )
 {
     _genreApi = genreApi;
 }
 public ApiTVShowRequest( IMovieDbSettings settings, IApiGenreRequest genreApi )
     : base( settings )
 {
     _genreApi = genreApi;
 }