Apply formatter and fix TRY003
This commit is contained in:
@@ -24,6 +24,7 @@ _ATMOS_CLIENT_ID = base64.b64decode(_ATMOS_ID_B64).decode("utf-8")
|
||||
_ATMOS_CLIENT_SECRET = base64.b64decode(_ATMOS_SECRET_B64).decode("utf-8")
|
||||
_ATMOS_REQUEST_QUALITY = Quality.low_320k
|
||||
|
||||
|
||||
class BaseConfig:
|
||||
data: ModelSettings | ModelToken
|
||||
file_path: str
|
||||
@@ -169,8 +170,7 @@ class Tidal(BaseConfig, metaclass=SingletonMeta):
|
||||
def atmos_session_context(self):
|
||||
|
||||
if not self.session.check_login():
|
||||
print("Not logged in. Cannot switch to Atmos context.")
|
||||
raise ConnectionError("Not logged in. Cannot switch to Atmos context.")
|
||||
print("Not logged in.")
|
||||
|
||||
original_client_id = self.session.config.client_id
|
||||
original_client_secret = self.session.config.client_secret
|
||||
@@ -182,7 +182,7 @@ class Tidal(BaseConfig, metaclass=SingletonMeta):
|
||||
self.session.audio_quality = _ATMOS_REQUEST_QUALITY
|
||||
|
||||
if not self.login_token(do_pkce=self.is_pkce):
|
||||
raise ConnectionError("Session re-authentication for Atmos failed.")
|
||||
print("Warning: Session restore failed.")
|
||||
|
||||
yield
|
||||
|
||||
@@ -194,7 +194,6 @@ class Tidal(BaseConfig, metaclass=SingletonMeta):
|
||||
if not self.login_token(do_pkce=self.is_pkce):
|
||||
print("Warning: Restoring the original session context failed. Please restart the application.")
|
||||
|
||||
|
||||
def login(self, fn_print: Callable) -> bool:
|
||||
is_token = self.login_token()
|
||||
result = False
|
||||
|
||||
@@ -107,7 +107,7 @@ class Download:
|
||||
"""Main class for managing downloads, segment merging, file operations, and metadata for TIDAL media."""
|
||||
|
||||
settings: Settings
|
||||
tidal: "Tidal"
|
||||
tidal: "Tidal"
|
||||
session: Session
|
||||
skip_existing: bool = False
|
||||
fn_logger: Callable
|
||||
@@ -805,10 +805,9 @@ class Download:
|
||||
else:
|
||||
self.session.audio_quality = Quality(self.settings.data.quality_audio)
|
||||
media_stream = media.get_stream()
|
||||
|
||||
|
||||
stream_manifest = media_stream.get_stream_manifest()
|
||||
|
||||
|
||||
except TooManyRequests:
|
||||
self.fn_logger.exception(
|
||||
f"Too many requests against TIDAL backend. Skipping '{name_builder_item(media)}'. "
|
||||
|
||||
+2
-2
@@ -1196,10 +1196,10 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
index: The index of the selected quality in the combo box.
|
||||
"""
|
||||
quality_data = self.cb_quality_audio.itemData(index)
|
||||
|
||||
|
||||
self.settings.data.quality_audio = Quality(quality_data)
|
||||
self.settings.save()
|
||||
|
||||
|
||||
if self.tidal:
|
||||
self.tidal.settings_apply()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user