From 5f5649a0f3fb9071390197bc8086a6ec868c2a51 Mon Sep 17 00:00:00 2001 From: Hellow Date: Tue, 4 Apr 2023 20:28:14 +0200 Subject: [PATCH] download fails pretty much work --- src/music_kraken/__init__.py | 1 + src/music_kraken/pages/support_classes/download_result.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/music_kraken/__init__.py b/src/music_kraken/__init__.py index c2d7f7c..0fc8fb5 100644 --- a/src/music_kraken/__init__.py +++ b/src/music_kraken/__init__.py @@ -65,6 +65,7 @@ def cli(): r = search.download_chosen() print() print(r) + print(r._error_message_list) return True url = re.match(URL_REGGEX, query) diff --git a/src/music_kraken/pages/support_classes/download_result.py b/src/music_kraken/pages/support_classes/download_result.py index 78cf0e2..2a63839 100644 --- a/src/music_kraken/pages/support_classes/download_result.py +++ b/src/music_kraken/pages/support_classes/download_result.py @@ -1,4 +1,5 @@ -from dataclasses import dataclass +from dataclasses import dataclass, field +from typing import List @dataclass @@ -7,6 +8,8 @@ class DownloadResult: fail: int = 0 error_message: str = None + _error_message_list: List[str] = field(default_factory=list) + @property def success(self) -> int: return self.total - self.fail @@ -17,11 +20,13 @@ class DownloadResult: def merge(self, other: "DownloadResult"): if other.fatal_error: + self._error_message_list.append(other.error_message) self.total += 1 self.fail += 1 else: self.total += other.total self.fail += other.fail + self._error_message_list.extend(other._error_message_list) def __repr__(self): if self.fatal_error: