summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Honz <exislow+github@gmail.com>2024-03-22 18:18:51 +0100
committerRobert Honz <exislow+github@gmail.com>2024-03-22 18:18:51 +0100
commitd47517dd4b8aebadaf941b55d0421d390588813c (patch)
tree60d929efa5569affd7a7f77170975f3d1c2da2c1
parent48fd379ebaed9398791bd1dab819a6351b3763df (diff)
downloadtidal-dl-ng-d47517dd4b8aebadaf941b55d0421d390588813c.tar.gz
✨ All albums of an artist can be downloaded.
-rw-r--r--tidal_dl_ng/gui.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/tidal_dl_ng/gui.py b/tidal_dl_ng/gui.py
index e1ca19d..3ef600e 100644
--- a/tidal_dl_ng/gui.py
+++ b/tidal_dl_ng/gui.py
@@ -567,10 +567,30 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
if len(items) == 0:
logger_gui.error("Please select a row first.")
else:
+ # If it is an artist resolve it with all available albums of him
+ if len(items) == 1:
+ tmp_media: QtWidgets.QTreeWidgetItem = items[0].data(5, QtCore.Qt.ItemDataRole.UserRole)
+
+ if isinstance(tmp_media, Artist):
+ tmp_children: [QtWidgets.QTreeWidgetItem] = []
+ is_dummy_child = not bool(items[0].child(0).data(5, QtCore.Qt.ItemDataRole.UserRole))
+
+ # Use the expand function to retrieve all albums.
+ if is_dummy_child:
+ self.on_tr_results_expanded(items[0])
+
+ count_children: int = items[0].childCount()
+
+ # Get all children.
+ for idx in range(count_children):
+ tmp_children.append(items[0].child(idx))
+
+ items: [Album] = tmp_children
+
items_pos_last = len(items) - 1
for item in items:
- media: Track | Album | Playlist | Video = item.data(5, QtCore.Qt.ItemDataRole.UserRole)
+ media: Track | Album | Playlist | Video | Artist = item.data(5, QtCore.Qt.ItemDataRole.UserRole)
# Skip only if Track item, skip option set and the item is not the last in the list.
download_delay: bool = bool(
isinstance(media, Track | Video)
@@ -583,7 +603,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.pb_download.setText("Download")
self.pb_download.setEnabled(True)
- def download(self, media: Track | Album | Playlist | Video | Mix, dl: Download, delay_track: bool = False) -> None:
+ def download(
+ self, media: Track | Album | Playlist | Video | Mix | Artist, dl: Download, delay_track: bool = False
+ ) -> None:
self.s_pb_reset.emit()
self.s_statusbar_message.emit(StatusbarMessage(message="Download started..."))