X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fimdb%2Fimdb-plaintext-downloader.vala;h=8b95f36483316714d58f9f1e94aae2040d19ce13;hb=f7140bdccbf65b1d75f88379838ca646fdbcb862;hp=a8462c0ad51931be580c9f4fcb65e119cd7df543;hpb=0882ba07c47a9a79756afb08b3849fc1a2e2d5a2;p=cinaest diff --git a/src/imdb/imdb-plaintext-downloader.vala b/src/imdb/imdb-plaintext-downloader.vala index a8462c0..8b95f36 100644 --- a/src/imdb/imdb-plaintext-downloader.vala +++ b/src/imdb/imdb-plaintext-downloader.vala @@ -79,52 +79,54 @@ class IMDbDownloadServer : Object, IMDbDownloader { 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); @@ -157,8 +159,11 @@ class IMDbDownloadServer : Object, IMDbDownloader { 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 () {