IMDb plaintext downloader: fix progress indicator
[cinaest] / src / imdb / imdb-gzip-parser.vala
index a729206..b13069c 100644 (file)
@@ -10,6 +10,8 @@ class IMDbGzipParser {
                parser = _parser;
 
                var file = File.new_for_path (path);
+               var info = file.query_info (FILE_ATTRIBUTE_STANDARD_SIZE, FileQueryInfoFlags.NONE, cancellable);
+               int total = (int) info.get_size ();
                var gz_stream = new GzipInputStream (file.read (cancellable));
                var stream = new DataInputStream (gz_stream);
 
@@ -23,7 +25,7 @@ class IMDbGzipParser {
                        line = stream.read_line (out length, cancellable);
                        if (gz_stream.total_in () > total_in) {
                                total_in = (int) gz_stream.total_in ();
-                               progress (0, total_in);
+                               progress (total, total_in);
                        }
                }
        }