refactor(gui): ✨ update album download options and improve session validation
* Added a new action to download all albums in a playlist. * Removed the deprecated `validate_session` method and replaced it with a direct call to `self.tidal.session.check_login()`. * Adjusted the UI layout in `dialog_settings` to accommodate new options and improved sizing.
This commit is contained in:
@@ -224,14 +224,6 @@ class Tidal(BaseConfig, metaclass=SingletonMeta):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def validate_session(self) -> bool:
|
|
||||||
"""Validate that the TIDAL session is still authenticated.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
bool: True if session is valid, False otherwise.
|
|
||||||
"""
|
|
||||||
return self.session.check_login()
|
|
||||||
|
|
||||||
def is_authentication_error(self, error: Exception) -> bool:
|
def is_authentication_error(self, error: Exception) -> bool:
|
||||||
"""Check if an error is related to authentication/OAuth issues.
|
"""Check if an error is related to authentication/OAuth issues.
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -568,8 +568,10 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
# We build the menu.
|
# We build the menu.
|
||||||
menu = QtWidgets.QMenu()
|
menu = QtWidgets.QMenu()
|
||||||
menu.addAction("Download Playlist", lambda: self.thread_download_list_media(point))
|
menu.addAction("Download Playlist", lambda: self.thread_download_list_media(point))
|
||||||
|
menu.addAction(
|
||||||
|
"Download All Albums in Playlist", lambda: self.thread_it(self.on_download_all_albums_from_playlist, point)
|
||||||
|
)
|
||||||
menu.addAction("Copy Share URL", lambda: self.on_copy_url_share(self.tr_lists_user, point))
|
menu.addAction("Copy Share URL", lambda: self.on_copy_url_share(self.tr_lists_user, point))
|
||||||
menu.addAction("Download All Albums", lambda: self.thread_it(self.on_download_all_albums_from_playlist, point))
|
|
||||||
|
|
||||||
menu.exec(self.tr_lists_user.mapToGlobal(point))
|
menu.exec(self.tr_lists_user.mapToGlobal(point))
|
||||||
|
|
||||||
@@ -742,7 +744,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
time.sleep(delay_sec)
|
time.sleep(delay_sec)
|
||||||
|
|
||||||
# Check session validity before making API calls
|
# Check session validity before making API calls
|
||||||
if not self.tidal.validate_session():
|
if not self.tidal.session.check_login():
|
||||||
logger_gui.error("Session expired. Please restart the application and login again.")
|
logger_gui.error("Session expired. Please restart the application and login again.")
|
||||||
return albums_dict
|
return albums_dict
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Ui_DialogSettings:
|
|||||||
def setupUi(self, DialogSettings):
|
def setupUi(self, DialogSettings):
|
||||||
if not DialogSettings.objectName():
|
if not DialogSettings.objectName():
|
||||||
DialogSettings.setObjectName("DialogSettings")
|
DialogSettings.setObjectName("DialogSettings")
|
||||||
DialogSettings.resize(640, 800)
|
DialogSettings.resize(640, 832)
|
||||||
sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
||||||
sizePolicy.setHorizontalStretch(100)
|
sizePolicy.setHorizontalStretch(100)
|
||||||
sizePolicy.setVerticalStretch(100)
|
sizePolicy.setVerticalStretch(100)
|
||||||
@@ -187,20 +187,6 @@ class Ui_DialogSettings:
|
|||||||
|
|
||||||
self.horizontalLayout_12.addLayout(self.lv_playlist_create)
|
self.horizontalLayout_12.addLayout(self.lv_playlist_create)
|
||||||
|
|
||||||
self.lv_flag_use_primary_album_artist = QVBoxLayout()
|
|
||||||
self.lv_flag_use_primary_album_artist.setObjectName("lv_flag_use_primary_album_artist")
|
|
||||||
self.cb_use_primary_album_artist = QCheckBox(self.gb_flags)
|
|
||||||
self.cb_use_primary_album_artist.setObjectName("cb_use_primary_album_artist")
|
|
||||||
|
|
||||||
self.lv_flag_use_primary_album_artist.addWidget(self.cb_use_primary_album_artist)
|
|
||||||
|
|
||||||
self.horizontalLayout_12.addLayout(self.lv_flag_use_primary_album_artist)
|
|
||||||
|
|
||||||
self.lv_flags.addLayout(self.horizontalLayout_12)
|
|
||||||
|
|
||||||
self.horizontalLayout_13 = QHBoxLayout()
|
|
||||||
self.horizontalLayout_13.setObjectName("horizontalLayout_13")
|
|
||||||
|
|
||||||
self.lv_mark_explicit = QVBoxLayout()
|
self.lv_mark_explicit = QVBoxLayout()
|
||||||
self.lv_mark_explicit.setObjectName("lv_mark_explicit")
|
self.lv_mark_explicit.setObjectName("lv_mark_explicit")
|
||||||
self.cb_mark_explicit = QCheckBox(self.gb_flags)
|
self.cb_mark_explicit = QCheckBox(self.gb_flags)
|
||||||
@@ -208,26 +194,31 @@ class Ui_DialogSettings:
|
|||||||
|
|
||||||
self.lv_mark_explicit.addWidget(self.cb_mark_explicit)
|
self.lv_mark_explicit.addWidget(self.cb_mark_explicit)
|
||||||
|
|
||||||
self.horizontalLayout_13.addLayout(self.lv_mark_explicit)
|
self.horizontalLayout_12.addLayout(self.lv_mark_explicit)
|
||||||
|
|
||||||
self.lv_flags.addLayout(self.horizontalLayout_13)
|
self.lv_flags.addLayout(self.horizontalLayout_12)
|
||||||
|
|
||||||
self.lh_flags_atmos = QHBoxLayout()
|
self.horizontalLayout_13 = QHBoxLayout()
|
||||||
self.lh_flags_atmos.setObjectName("lh_flags_atmos")
|
self.horizontalLayout_13.setObjectName("horizontalLayout_13")
|
||||||
self.lv_flag_download_dolby_atmos = QVBoxLayout()
|
self.lv_use_primary_album_artist = QVBoxLayout()
|
||||||
self.lv_flag_download_dolby_atmos.setObjectName("lv_flag_download_dolby_atmos")
|
self.lv_use_primary_album_artist.setObjectName("lv_use_primary_album_artist")
|
||||||
|
self.cb_use_primary_album_artist = QCheckBox(self.gb_flags)
|
||||||
|
self.cb_use_primary_album_artist.setObjectName("cb_use_primary_album_artist")
|
||||||
|
|
||||||
|
self.lv_use_primary_album_artist.addWidget(self.cb_use_primary_album_artist)
|
||||||
|
|
||||||
|
self.horizontalLayout_13.addLayout(self.lv_use_primary_album_artist)
|
||||||
|
|
||||||
|
self.lv_download_dolby_atmos = QVBoxLayout()
|
||||||
|
self.lv_download_dolby_atmos.setObjectName("lv_download_dolby_atmos")
|
||||||
self.cb_download_dolby_atmos = QCheckBox(self.gb_flags)
|
self.cb_download_dolby_atmos = QCheckBox(self.gb_flags)
|
||||||
self.cb_download_dolby_atmos.setObjectName("cb_download_dolby_atmos")
|
self.cb_download_dolby_atmos.setObjectName("cb_download_dolby_atmos")
|
||||||
|
|
||||||
self.lv_flag_download_dolby_atmos.addWidget(self.cb_download_dolby_atmos)
|
self.lv_download_dolby_atmos.addWidget(self.cb_download_dolby_atmos)
|
||||||
|
|
||||||
self.lh_flags_atmos.addLayout(self.lv_flag_download_dolby_atmos)
|
self.horizontalLayout_13.addLayout(self.lv_download_dolby_atmos)
|
||||||
|
|
||||||
self.lv_flag_empty_atmos = QVBoxLayout()
|
self.lv_flags.addLayout(self.horizontalLayout_13)
|
||||||
self.lv_flag_empty_atmos.setObjectName("lv_flag_empty_atmos")
|
|
||||||
self.lh_flags_atmos.addLayout(self.lv_flag_empty_atmos)
|
|
||||||
|
|
||||||
self.lv_flags.addLayout(self.lh_flags_atmos)
|
|
||||||
|
|
||||||
self.lv_main.addWidget(self.gb_flags)
|
self.lv_main.addWidget(self.gb_flags)
|
||||||
|
|
||||||
@@ -626,7 +617,6 @@ class Ui_DialogSettings:
|
|||||||
# endif // QT_CONFIG(whatsthis)
|
# endif // QT_CONFIG(whatsthis)
|
||||||
self.cb_lyrics_embed.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
self.cb_lyrics_embed.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
||||||
self.cb_lyrics_file.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
self.cb_lyrics_file.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
||||||
self.cb_use_primary_album_artist.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
|
||||||
self.cb_download_delay.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
self.cb_download_delay.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
||||||
self.cb_extract_flac.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
self.cb_extract_flac.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
||||||
self.cb_metadata_cover_embed.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
self.cb_metadata_cover_embed.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
||||||
@@ -635,6 +625,8 @@ class Ui_DialogSettings:
|
|||||||
self.cb_symlink_to_track.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
self.cb_symlink_to_track.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
||||||
self.cb_playlist_create.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
self.cb_playlist_create.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
||||||
self.cb_mark_explicit.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
self.cb_mark_explicit.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
||||||
|
self.cb_use_primary_album_artist.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
||||||
|
self.cb_download_dolby_atmos.setText(QCoreApplication.translate("DialogSettings", "CheckBox", None))
|
||||||
self.gb_choices.setTitle(QCoreApplication.translate("DialogSettings", "Choices", None))
|
self.gb_choices.setTitle(QCoreApplication.translate("DialogSettings", "Choices", None))
|
||||||
self.l_icon_quality_audio.setText(QCoreApplication.translate("DialogSettings", "TextLabel", None))
|
self.l_icon_quality_audio.setText(QCoreApplication.translate("DialogSettings", "TextLabel", None))
|
||||||
self.l_quality_audio.setText(QCoreApplication.translate("DialogSettings", "TextLabel", None))
|
self.l_quality_audio.setText(QCoreApplication.translate("DialogSettings", "TextLabel", None))
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>640</width>
|
<width>640</width>
|
||||||
<height>800</height>
|
<height>832</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -262,6 +262,32 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="lv_use_primary_album_artist">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cb_use_primary_album_artist">
|
||||||
|
<property name="text">
|
||||||
|
<string>CheckBox</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="lv_download_dolby_atmos">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cb_download_dolby_atmos">
|
||||||
|
<property name="text">
|
||||||
|
<string>CheckBox</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user