diff --git a/src/music_kraken/__init__.py b/src/music_kraken/__init__.py index c2d7f7c..7f98f2f 100644 --- a/src/music_kraken/__init__.py +++ b/src/music_kraken/__init__.py @@ -63,9 +63,12 @@ def cli(): if parsed in DOWNLOAD_COMMANDS: r = search.download_chosen() + print() print(r) - return True + print() + + return not r.is_mild_failure url = re.match(URL_REGGEX, query) if url is not None: diff --git a/src/music_kraken/pages/abstract.py b/src/music_kraken/pages/abstract.py index 68b15fc..0ca8c36 100644 --- a/src/music_kraken/pages/abstract.py +++ b/src/music_kraken/pages/abstract.py @@ -491,7 +491,7 @@ class Page: r = cls._download_song_to_targets(source=sources[0], target=temp_target, desc=song.title) - if not r.fatal_error: + if not r.is_fatal_error: cls._post_process_targets(song, temp_target) return r diff --git a/src/music_kraken/pages/support_classes/download_result.py b/src/music_kraken/pages/support_classes/download_result.py index ccd8eed..6f6aeeb 100644 --- a/src/music_kraken/pages/support_classes/download_result.py +++ b/src/music_kraken/pages/support_classes/download_result.py @@ -25,11 +25,15 @@ class DownloadResult: return self.fail / self.total @property - def fatal_error(self) -> bool: + def is_fatal_error(self) -> bool: return self.error_message is not None + @property + def is_mild_failure(self) -> bool: + return self.failure_percentage > SHOW_DOWNLOAD_ERRORS_THRESHOLD + def merge(self, other: "DownloadResult"): - if other.fatal_error: + if other.is_fatal_error: LOGGER.debug(other.error_message) self._error_message_list.append(other.error_message) self.total += 1 @@ -40,13 +44,13 @@ class DownloadResult: self._error_message_list.extend(other._error_message_list) def __str__(self): - if self.fatal_error: + if self.is_fatal_error: return self.error_message head = f"{self.fail} from {self.total} downloads failed:\n" \ f"successrate:\t{int(self.success_percentage*100)}%\n" \ - f"failrate:\t\t{int(self.failure_percentage*100)}%" + f"failrate:\t{int(self.failure_percentage*100)}%" - if self.failure_percentage <= SHOW_DOWNLOAD_ERRORS_THRESHOLD: + if not self.is_mild_failure: return head _lines = [head] diff --git a/src/music_kraken/utils/shared.py b/src/music_kraken/utils/shared.py index d33d2d6..9242d98 100644 --- a/src/music_kraken/utils/shared.py +++ b/src/music_kraken/utils/shared.py @@ -22,7 +22,7 @@ HAPPY_MESSAGES: List[str] = [ "🏳️‍⚧️🏳️‍⚧️ Trans women are women, trans men are men. 🏳️‍⚧️🏳️‍⚧️", "🏴‍☠️🏴‍☠️ Unite under one flag, fuck borders. 🏴‍☠️🏴‍☠️", "Join my Matrix Space: https://matrix.to/#/#music-kraken:matrix.org", - "Gotta love BPJM!! :/" + "Gotta love the BPJM!! :/" ] @@ -54,6 +54,7 @@ GENIUS_LOGGER = logging.getLogger("genius") ENCYCLOPAEDIA_METALLUM_LOGGER = logging.getLogger("ma") DOWNLOAD_LOGGER = logging.getLogger("download") +TAGGING_LOGGER = logging.getLogger("tagging") NOT_A_GENRE = ".", "..", "misc_scripts", "Music", "script", ".git", ".idea" MUSIC_DIR = Path(os.path.expanduser("~"), "Music")