Skip to content

Commit

Permalink
Provided clearer error handling when downloading without ARL
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalec committed Mar 16, 2022
1 parent 5314f25 commit b6be50c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions deemon/cmd/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions deemon/cmd/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand Down
11 changes: 8 additions & 3 deletions deemon/core/dmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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:
Expand Down

0 comments on commit b6be50c

Please sign in to comment.