downloader.progress.connect (on_progress);
var parser = new IMDbGzipParser (cancellable);
+ parser.progress.connect (on_progress);
if (MOVIES in flags) {
description_changed ("Downloading movie list ...");
downloader.download (url + "movies.list.gz", Path.build_filename (cache_dir, "movies.list.gz"));
}
- percent_finished = 20;
+ percent_finished = 10;
if (GENRES in flags) {
description_changed ("Downloading genre data ...");
downloader.download (url + "genres.list.gz", Path.build_filename (cache_dir, "genres.list.gz"));
}
- percent_finished = 40;
+ percent_finished = 20;
if (RATINGS in flags) {
description_changed ("Downloading rating data ...");
downloader.download (url + "ratings.list.gz", Path.build_filename (cache_dir, "ratings.list.gz"));
}
- percent_finished = 60;
+ percent_finished = 30;
if (AKAS in flags) {
description_changed ("Downloading alternative titles ...");
downloader.download (url + "aka-titles.list.gz", Path.build_filename (cache_dir, "aka-titles.list.gz"));
}
- percent_finished = 80;
+ percent_finished = 40;
if (PLOTS in flags) {
description_changed ("Downloading plots ...");
downloader.download (url + "plot.list.gz", Path.build_filename (cache_dir, "plot.list.gz"));
}
+ percent_finished = 50;
if (MOVIES in flags) {
description_changed ("Parsing movie list ...");
parser.parse (Path.build_filename (cache_dir, "movies.list.gz"), movie_parser);
}
- percent_finished = 20;
+ percent_finished = 60;
if (GENRES in flags) {
description_changed ("Parsing genre data ...");
parser.parse (Path.build_filename (cache_dir, "genres.list.gz"), genre_parser);
}
- percent_finished = 40;
+ percent_finished = 70;
if (RATINGS in flags) {
description_changed ("Parsing rating data ...");
parser.parse (Path.build_filename (cache_dir, "ratings.list.gz"), rating_parser);
}
- percent_finished = 60;
+ percent_finished = 80;
if (AKAS in flags) {
description_changed ("Parsing alternative titles ...");
parser.parse (Path.build_filename (cache_dir, "aka-titles.list.gz"), aka_parser);
}
- percent_finished = 80;
+ percent_finished = 90;
if (PLOTS in flags) {
description_changed ("Parsing plots ...");
parser.parse (Path.build_filename (cache_dir, "plot.list.gz"), plot_parser);
private void on_progress (int dltotal, int dlnow) {
stdout.printf ("%d / %d\r", dlnow, dltotal);
- if (dltotal > 0)
- progress (99*dlnow/dltotal/100);
+ if (dltotal > 0) {
+ int p = percent_finished + 10*dlnow/dltotal;
+ if (p < 100)
+ progress (p);
+ }
}
private void timeout_quit () {