Example #1
0
        private List <TVTProgramme> GenerateTVTMovies(List <MovieResult> TmdbList)
        {
            var result = new List <TVTProgramme>();
            var filler = new FillMovieExtended();

            foreach (var entry in TmdbList)
            {
                var movie = new TVTProgramme();
                Console.WriteLine("Load details '{0}'", entry.title);
                filler.LoadDetailsFromTmDB(this, movie, entry);
                result.Add(movie);
            }
            return(result);
        }
Example #2
0
        public void Start()
        {
            var fillMovies = new FillMovieExtended();

            List <MovieResult> movieExport = new List <MovieResult>();

            ServiceApi.InitializeApis();

            //for ( var year = 1954; year <= 1955; year++ )
            for (var year = 1954; year <= 1959; year++)
            //for ( var year = 1920; year <= 2013; year++ ) //Kein Film vor 1920 gefunden
            {
                if (_shouldStop)
                {
                    break;
                }

                Console.WriteLine("Import year '{0}'", year);

                var maxpage         = 1;
                var movieCollection = new List <MovieResult>();

                for (var page = 1; page <= maxpage; page++)
                {
                    Console.WriteLine("Import movies '{0}'", page);

                    RequestChecker.TmDbReadyOrWait();
                    var movieList = ServiceApi.TmdbApi.DiscoverMovie(page, "DE", true, null, year, 10, 2, "DE", "A");

                    movieCollection.AddRange(movieList.results);

                    maxpage = movieList.total_pages;
                }
                var sortedList = movieCollection.OrderByDescending(x => x.popularity);

                if (year < 1950)
                {
                    movieExport.AddRange(sortedList.Take(3));
                }
                else if (year < 1965)
                {
                    movieExport.AddRange(sortedList.Take(5));
                }
                else if (year < 1980)
                {
                    movieExport.AddRange(sortedList.Take(8));
                }
                else if (year < 1990)
                {
                    movieExport.AddRange(sortedList.Take(12));
                }
                else
                {
                    movieExport.AddRange(sortedList.Take(25));
                }
            }



            var resultList = GenerateTVTMovies(movieExport);

            foreach (var entry in resultList)
            {
                Console.WriteLine("Add result '{0}'", entry.TitleDE);
                MovieStatistics.Add(entry.Year, entry.MovieAdditional.Budget, entry.MovieAdditional.Revenue);
            }

            foreach (var entry in resultList)
            {
                Console.WriteLine("Calc rating '{0}'", entry.TitleDE);
                if (!_shouldStop)
                {
                    fillMovies.calcRating(this, entry);
                }
                Database.AddProgramme(entry);
            }

            Result = resultList;

            if (FinishEvent != null)
            {
                FinishEvent(this, new EventArgs());
            }
        }