示例#1
0
        private static void GetMoviesFromImdbToDatabase()
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();

            List <Movie> movies = new List <Movie>();

            MovieManager movieManager  = new MovieManager(new TaskManager());
            int          defaultImdbId = Int32.Parse(ConfigReader.GetConfigValue("defaultImdbId")); //tt0098000 - Nocturne indien (1989) - pociatok ziskavania filmov?

            int imdbIdLastProcessed = dbProcessor.GetMovieIdForNextProcessing();
            int imdbIdForProcessing = imdbIdLastProcessed == 0 ? defaultImdbId : (imdbIdLastProcessed + 1);
            int batchSize           = Int32.Parse(ConfigReader.GetConfigValue("batchSize"));

            Console.WriteLine($"Data budu ziskavane pre IMDB filmy od ID = {imdbIdForProcessing}");
            movies = movieManager.GetMoviesFomImdb(imdbIdForProcessing, batchSize);

            sw.Restart();
            dbProcessor.SaveMoviesToDatabase(movies);
            sw.Stop();
            Logger.Instance.WriteLog($"Save movies to DB - duration: {sw.ElapsedMilliseconds} ms");
        }
示例#2
0
 public TaskManager()
 {
     MovieTasks  = new List <Task <List <Movie> > >();
     MovieGetter = new MovieBatchGetter();
     TaskCount   = Int32.Parse(ConfigReader.GetConfigValue("taskCount"));
 }
示例#3
0
 private Logger()
 {
     LogFullPath = ConfigReader.GetConfigValue("logPath") + "MoviesImdbLog_" + Guid.NewGuid().ToString() + ".txt";
 }
示例#4
0
 public MovieExporter()
 {
     CsvHeader     = ConfigReader.GetConfigValue("csvHeader");
     CsvExportPath = ConfigReader.GetConfigValue("csvExportPath");
 }