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"); }
public TaskManager() { MovieTasks = new List <Task <List <Movie> > >(); MovieGetter = new MovieBatchGetter(); TaskCount = Int32.Parse(ConfigReader.GetConfigValue("taskCount")); }
private Logger() { LogFullPath = ConfigReader.GetConfigValue("logPath") + "MoviesImdbLog_" + Guid.NewGuid().ToString() + ".txt"; }
public MovieExporter() { CsvHeader = ConfigReader.GetConfigValue("csvHeader"); CsvExportPath = ConfigReader.GetConfigValue("csvExportPath"); }