From 0f9550ad776fde152cf3a79cafc1cbb4eee4772e Mon Sep 17 00:00:00 2001 From: Hellow Date: Tue, 4 Apr 2023 20:30:01 +0200 Subject: [PATCH] added success percentage --- src/music_kraken/pages/support_classes/download_result.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/music_kraken/pages/support_classes/download_result.py b/src/music_kraken/pages/support_classes/download_result.py index 2a63839..423c916 100644 --- a/src/music_kraken/pages/support_classes/download_result.py +++ b/src/music_kraken/pages/support_classes/download_result.py @@ -14,6 +14,10 @@ class DownloadResult: def success(self) -> int: return self.total - self.fail + @property + def success_percentage(self) -> float: + return self.success / self.total + @property def fatal_error(self) -> bool: return self.error_message is not None @@ -31,4 +35,4 @@ class DownloadResult: def __repr__(self): if self.fatal_error: return self.error_message - return f"{self.fail} from {self.total} downloads failed." + return f"({int(self.success_percentage*100)}%) {self.fail} from {self.total} downloads failed."