diff options
| author | Robert Honz <exislow+github@gmail.com> | 2024-03-29 12:32:11 +0100 |
|---|---|---|
| committer | Robert Honz <exislow+github@gmail.com> | 2024-03-29 12:32:11 +0100 |
| commit | 9dd8f6c856cf39cc1d228e171c1c81ff1d6e4b2f (patch) | |
| tree | b70a573c4577deeaa0e3bc8a7774e3d444b8ad42 /tidal_dl_ng/helper | |
| parent | a53f63fbe9c8bbd6b46b9a631792a2a48d0d78e4 (diff) | |
| parent | ead4b8a905820891161e4cbd81cab6e07b51a8f0 (diff) | |
| download | tidal-dl-ng-9dd8f6c856cf39cc1d228e171c1c81ff1d6e4b2f.tar.gz | |
Merge branch '71-feature-show-queued-downloads'
* 71-feature-show-queued-downloads:
✨ Lists can also be downloaded using the "Download List" button.
👌 Reduced network traffic for covers.
✨ Display cover in info area.
✨ Use `Album.image()` to get cover url.
✨ Software named explicitly.
✨ Info pane will be initialized correctly.
✨ Added info pane to GUI.
# Conflicts:
# tidal_dl_ng/gui.py
Diffstat (limited to 'tidal_dl_ng/helper')
| -rw-r--r-- | tidal_dl_ng/helper/gui.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tidal_dl_ng/helper/gui.py b/tidal_dl_ng/helper/gui.py new file mode 100644 index 0000000..604772e --- /dev/null +++ b/tidal_dl_ng/helper/gui.py @@ -0,0 +1,37 @@ +from PySide6 import QtCore, QtWidgets +from tidalapi import Album, Mix, Playlist, Track, UserPlaylist, Video +from tidalapi.artist import Artist + + +def get_table_data( + item: QtWidgets.QTreeWidgetItem, column: int +) -> Track | Video | Album | Artist | Mix | Playlist | UserPlaylist: + result: Track | Video | Album | Artist = item.data(column, QtCore.Qt.ItemDataRole.UserRole) + + return result + + +def get_results_media_item(item: QtWidgets.QTreeWidgetItem) -> Track | Video | Album | Artist: + result: Track | Video | Album | Artist = get_table_data(item, 1) + + return result + + +def get_user_list_media_item(item: QtWidgets.QTreeWidgetItem) -> Mix | Playlist | UserPlaylist: + result: Mix | Playlist | UserPlaylist = get_table_data(item, 1) + + return result + + +def set_table_data( + item: QtWidgets.QTreeWidgetItem, data: Track | Video | Album | Artist | Mix | Playlist | UserPlaylist, column: int +): + item.setData(column, QtCore.Qt.ItemDataRole.UserRole, data) + + +def set_results_media(item: QtWidgets.QTreeWidgetItem, media: Track | Video | Album | Artist): + set_table_data(item, media, 1) + + +def set_user_list_media(item: QtWidgets.QTreeWidgetItem, media: Mix | Playlist | UserPlaylist): + set_table_data(item, media, 1) |
