summaryrefslogtreecommitdiff
path: root/tidal_dl_ng/gui.py
diff options
context:
space:
mode:
authorexislow <exislow@users.noreply.github.com>2024-02-01 20:05:25 +0100
committerGitHub <noreply@github.com>2024-02-01 20:05:25 +0100
commit9306a30f250b880ab092d27e08a809cd5f7ae7c7 (patch)
tree082f5b16d7324986640bb3f0c68bdcf7fe969400 /tidal_dl_ng/gui.py
parent4b21ecd820159e7913eab62df83a3fc27bfafce6 (diff)
parentfe5d450cb3d3ae3514f11ec6685579b553ac6225 (diff)
downloadtidal-dl-ng-9306a30f250b880ab092d27e08a809cd5f7ae7c7.tar.gz
Merge pull request #26 from exislow/dl-wait-track
✨ Respect download delay when downloading a bunch of tracks / videos.
Diffstat (limited to 'tidal_dl_ng/gui.py')
-rw-r--r--tidal_dl_ng/gui.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/tidal_dl_ng/gui.py b/tidal_dl_ng/gui.py
index 2a1b2d1..267ff3b 100644
--- a/tidal_dl_ng/gui.py
+++ b/tidal_dl_ng/gui.py
@@ -483,25 +483,30 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
if len(items) == 0:
logger_gui.error("Please select a row first.")
else:
+ items_pos_last = len(items) - 1
+
for item in items:
media: Track | Album | Playlist | Video = 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)
+ and self.settings.data.download_delay
+ and items.index(item) < items_pos_last
+ )
- self.download(media, self.dl)
+ self.download(media, self.dl, delay_track=download_delay)
self.b_download.setText("Download")
self.b_download.setEnabled(True)
- def download(self, media: Track | Album | Playlist | Video | Mix, dl: Download) -> None:
+ def download(self, media: Track | Album | Playlist | Video | Mix, dl: Download, delay_track: bool = False) -> None:
self.s_pb_reset.emit()
self.s_statusbar_message.emit(StatusbarMessage(message="Download started..."))
file_template = get_format_template(media, self.settings)
if isinstance(media, Track | Video):
- dl.item(
- media=media,
- file_template=file_template,
- )
+ dl.item(media=media, file_template=file_template, download_delay=delay_track)
elif isinstance(media, Album | Playlist | Mix):
dl.items(
media=media,