Exemple #1
0
        public static async Task <TMDBSnapshot> CollectDataAsync(ITMDBService tmdbService, ILogger logger, string languageCode, string regionCode)
        {
            logger.LogInformation($"DataCollector collecting data for language \"{languageCode}\" started at: {DateTime.Now}");

            var tmdbSnapshot = new TMDBSnapshot
            {
                LanguageCode = languageCode,
                RegionCode   = regionCode
            };

            tmdbSnapshot.Configuration         = tmdbService.Configuration;
            tmdbSnapshot.ShowGenres            = (await tmdbService.GetShowGenresAsync(languageCode)).Values.ToList();
            tmdbSnapshot.MovieGenres           = (await tmdbService.GetMovieGenresAsync(languageCode)).Values.ToList();
            tmdbSnapshot.PopularShowsAndMovies = await tmdbService.GetPopularShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.ComedyShowsAndMovies = await tmdbService.GetComedyShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.DramaShowsAndMovies = await tmdbService.GetDramaShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.ActionAdventureShowsAndMovies = await tmdbService.GetActionAndAdventureShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.AnimationShowsAndMovies = await tmdbService.GetAnimationShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.ScifiShowsAndMovies = await tmdbService.GetScifiShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.CrimeShowsAndMovies = await tmdbService.GetCrimeShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.MysteryShowsAndMovies = await tmdbService.GetMysteryShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.ThrillerShowsAndMovies = await tmdbService.GetThrillerShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.HorrorShowsAndMovies = await tmdbService.GetHorrorShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.FamilyShowsAndMovies = await tmdbService.GetFamilyShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.KidsShowsAndMovies = await tmdbService.GetKidsShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.WesternShowsAndMovies = await tmdbService.GetWesternShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.FantasyMovies = await tmdbService.GetFantasyMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.HistoryShowsAndMovies = await tmdbService.GetHistoryShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.RomanceShowsAndMovies = await tmdbService.GetHistoryShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.WarShowsAndMovies = await tmdbService.GetWarShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.DocumentaryShowsAndMovies = await tmdbService.GetDocumentaryShowsAndMovies(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.SitcomShows = await tmdbService.GetSitcomShowsAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.AnthologyShows = await tmdbService.GetAnthologyShowsAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.AnimeShowsAndMovies = await tmdbService.GetAnimeShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.TeenDramaShowsAndMovies = await tmdbService.GetTeenDramaShowsAndMoviesAsync(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.HistoricalDramaShowsAndMovies = await tmdbService.GetHistoricalDramaShowsAndMovies(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.WorkplaceComedyShowsAndMovies = await tmdbService.GetWorkplaceComedyShowsAndMovies(languageCode, regionCode, NUMBER_OF_PAGES);

            tmdbSnapshot.MedicalDramaShowsAndMovies = await tmdbService.GetMedicalDramaShowsAndMovies(languageCode, regionCode, NUMBER_OF_PAGES);

            CollectionFilter.FilterCollections(tmdbSnapshot, logger);
            CreateRandomizedJSONCollection(tmdbSnapshot, logger);

            logger.LogInformation($"DataCollector collecting data for language \"{languageCode}\" finished at: {DateTime.Now}");
            return(tmdbSnapshot);
        }