Fix download evaluation
This commit is contained in:
@@ -41,7 +41,8 @@ class DownloadThread(BaseDownloadThread):
|
|||||||
"""Subclass BaseDownloadThread. Download the database, images and audio samples."""
|
"""Subclass BaseDownloadThread. Download the database, images and audio samples."""
|
||||||
|
|
||||||
progress = pyqtSignal(int, float)
|
progress = pyqtSignal(int, float)
|
||||||
_CHUNK = 1024**2
|
_CHUNK = 512 * 1024
|
||||||
|
_MEGA = 1024**2
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""Just call super().__init__."""
|
"""Just call super().__init__."""
|
||||||
@@ -51,7 +52,7 @@ class DownloadThread(BaseDownloadThread):
|
|||||||
|
|
||||||
def _pretty_len(self, byte_obj):
|
def _pretty_len(self, byte_obj):
|
||||||
"""Return a well-formatted number of downloaded MB."""
|
"""Return a well-formatted number of downloaded MB."""
|
||||||
mega = len(byte_obj) / self._CHUNK
|
mega = len(byte_obj) / self._MEGA
|
||||||
if mega.is_integer():
|
if mega.is_integer():
|
||||||
return int(mega)
|
return int(mega)
|
||||||
else:
|
else:
|
||||||
@@ -60,7 +61,7 @@ class DownloadThread(BaseDownloadThread):
|
|||||||
def _get_download_speed(self, data, delta):
|
def _get_download_speed(self, data, delta):
|
||||||
"""Return the download speed in MB/s."""
|
"""Return the download speed in MB/s."""
|
||||||
return round(
|
return round(
|
||||||
(len(data) / self._CHUNK) / delta, 2
|
(len(data) / self._MEGA) / delta, 2
|
||||||
)
|
)
|
||||||
|
|
||||||
def set_exit(self):
|
def set_exit(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user