From 3e8a3436b4ae0ef39f95e3208406d8536445894c Mon Sep 17 00:00:00 2001 From: Ali CHERIFI Date: Thu, 14 Jul 2022 22:43:12 +0200 Subject: [PATCH 1/2] Add capability to perform an artist search and download all albums --- TIDALDL-PY/tidal_dl/gui.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/TIDALDL-PY/tidal_dl/gui.py b/TIDALDL-PY/tidal_dl/gui.py index c2ba41e..51b77d9 100644 --- a/TIDALDL-PY/tidal_dl/gui.py +++ b/TIDALDL-PY/tidal_dl/gui.py @@ -91,7 +91,8 @@ else: self.c_widgetSetting = SettingView() self.c_widgetSetting.hide() - self.m_supportType = [Type.Album, Type.Playlist, Type.Track, Type.Video] + # Supported types for search + self.m_supportType = [Type.Album, Type.Playlist, Type.Track, Type.Video, Type.Artist] for item in self.m_supportType: self.c_combType.addItem(item.name, item) @@ -208,6 +209,10 @@ else: self.addItem(index, 1, item.title) self.addItem(index, 2, '') self.addItem(index, 3, '') + elif self.s_type in [Type.Artist]: + self.addItem(index, 1, item.name) + self.addItem(index, 2, '') + self.addItem(index, 3, '') self.c_tableInfo.viewport().update() def download(self): @@ -217,14 +222,24 @@ else: return self.c_btnDownload.setEnabled(False) - self.c_btnDownload.setText(f"Downloading [{self.s_array[index].title}]...") + item_to_download = "" + if isinstance(self.s_array[index], Artist): + item_to_download = self.s_array[index].name + else: + item_to_download = self.s_array[index].title + self.c_btnDownload.setText(f"Downloading [${item_to_download}]...") def __thread_download__(model: MainView): try: type = model.s_type item = model.s_array[index] start_type(type, item) - model.s_downloadEnd.emit(item.title, True, '') + item_name = "" + if isinstance(item, Artist): + item_name = item.name + else: + item_name = item.title + model.s_downloadEnd.emit(item_name, True, '') except Exception as e: model.s_downloadEnd.emit(item.title, False, str(e)) From 63bf063dd33eb59573961b20d47b3007a543bd96 Mon Sep 17 00:00:00 2001 From: Ali CHERIFI Date: Thu, 14 Jul 2022 22:51:38 +0200 Subject: [PATCH 2/2] Fix except block --- TIDALDL-PY/tidal_dl/gui.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/TIDALDL-PY/tidal_dl/gui.py b/TIDALDL-PY/tidal_dl/gui.py index 51b77d9..fddb6e3 100644 --- a/TIDALDL-PY/tidal_dl/gui.py +++ b/TIDALDL-PY/tidal_dl/gui.py @@ -230,18 +230,18 @@ else: self.c_btnDownload.setText(f"Downloading [${item_to_download}]...") def __thread_download__(model: MainView): + downloading_item = "" try: type = model.s_type item = model.s_array[index] start_type(type, item) - item_name = "" if isinstance(item, Artist): - item_name = item.name + downloading_item = item.name else: - item_name = item.title - model.s_downloadEnd.emit(item_name, True, '') + downloading_item = item.title + model.s_downloadEnd.emit(downloading_item, True, '') except Exception as e: - model.s_downloadEnd.emit(item.title, False, str(e)) + model.s_downloadEnd.emit(downloading_item, False, str(e)) _thread.start_new_thread(__thread_download__, (self, ))