Skip to content
Snippets Groups Projects
Commit e126703c authored by Alan De Smet's avatar Alan De Smet
Browse files

human format download speed

parent 15e328f2
No related branches found
No related tags found
No related merge requests found
......@@ -144,6 +144,10 @@ class DownloadStatistics:
def report(self):
self.finish()
speed = self.downloaded_size/(self.total_time().total_seconds())
if speed < 100:
speed_str = "{speed} B"
else:
speed_str = human_bytes(speed)
ret = [
f"Downloaded {self.downloaded_files} files "
f"totalling {human_bytes(self.downloaded_size)}.",
......@@ -152,7 +156,7 @@ class DownloadStatistics:
f"Deleted {self.deleted_files} files, "
f"freeing {human_bytes(self.deleted_size)} of space.",
f"Took {self.total_time()}.",
f"Average download speed of {speed:,.0f} bytes per second.",
f"Average download speed of {speed_str}/second.",
]
return ret
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment