From ef0581b6fb2cfbdfe86647a3132f7dce4bda7b5e Mon Sep 17 00:00:00 2001 From: alessandro90 Date: Sun, 9 Jun 2019 14:47:16 +0200 Subject: [PATCH] Fix download evaluation --- threads.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/threads.py b/threads.py index 2c6764a..fc0a122 100644 --- a/threads.py +++ b/threads.py @@ -41,7 +41,8 @@ class DownloadThread(BaseDownloadThread): """Subclass BaseDownloadThread. Download the database, images and audio samples.""" progress = pyqtSignal(int, float) - _CHUNK = 1024**2 + _CHUNK = 512 * 1024 + _MEGA = 1024**2 def __init__(self): """Just call super().__init__.""" @@ -51,7 +52,7 @@ class DownloadThread(BaseDownloadThread): def _pretty_len(self, byte_obj): """Return a well-formatted number of downloaded MB.""" - mega = len(byte_obj) / self._CHUNK + mega = len(byte_obj) / self._MEGA if mega.is_integer(): return int(mega) else: @@ -60,7 +61,7 @@ class DownloadThread(BaseDownloadThread): def _get_download_speed(self, data, delta): """Return the download speed in MB/s.""" return round( - (len(data) / self._CHUNK) / delta, 2 + (len(data) / self._MEGA) / delta, 2 ) def set_exit(self):