From b6be50c3941a92830bece0bbb49359546feaae58 Mon Sep 17 00:00:00 2001 From: digitalec <31838395+digitalec@users.noreply.github.com> Date: Tue, 15 Mar 2022 23:19:34 -0400 Subject: [PATCH] Provided clearer error handling when downloading without ARL --- deemon/cmd/download.py | 1 + deemon/cmd/search.py | 7 +++++-- deemon/core/dmi.py | 11 ++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/deemon/cmd/download.py b/deemon/cmd/download.py index 6f59f04..31b9cd8 100644 --- a/deemon/cmd/download.py +++ b/deemon/cmd/download.py @@ -134,6 +134,7 @@ def download_queue(self, queue_list: list = None): self.queue_list = queue_list if not self.di.login(): + logger.error("Failed to login, aborting download...") return False if self.queue_list: diff --git a/deemon/cmd/search.py b/deemon/cmd/search.py index f28d892..6d65c49 100644 --- a/deemon/cmd/search.py +++ b/deemon/cmd/search.py @@ -441,9 +441,12 @@ def start_queue(self): self.clear() dl = download.Download() dl.queue_list = self.queue_list - dl.download_queue() + download_result = dl.download_queue() self.queue_list.clear() - self.status_message = "Downloads complete" + if download_result: + self.status_message = "Downloads complete" + else: + self.status_message = "Downloads failed, please check logs" def send_to_queue(self, item): if item['record_type'] in ['album', 'ep', 'single']: diff --git a/deemon/core/dmi.py b/deemon/core/dmi.py index 8faf322..7d630c0 100644 --- a/deemon/core/dmi.py +++ b/deemon/core/dmi.py @@ -96,7 +96,10 @@ def login(self): if self.verify_arl(config.arl()): return True else: + logger.error("Unable to login using ARL found in deemon config") failed_logins += 1 + else: + logger.debug("ARL was not found in deemon config, checking if deemix has it...") if self.config_dir.is_dir(): if Path(self.config_dir / '.arl').is_file(): @@ -107,17 +110,19 @@ def login(self): if self.verify_arl(arl_from_file): return True else: + logger.error("Unable to login using ARL found in deemix config directory") failed_logins += 1 else: - logger.error(f"ARL not found in {self.config_dir}") - return False + logger.debug(f"ARL not found in {self.config_dir}") else: logger.error(f"ARL directory {self.config_dir} was not found") - return False if failed_logins > 1: notification = notifier.Notify() notification.expired_arl() + else: + logger.error("No ARL was found, aborting...") + return False def generatePlaylistItem(self, dz, link_id, bitrate, playlistAPI=None, playlistTracksAPI=None): if not playlistAPI: