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
|
||||
|
||||
@@ -808,7 +808,6 @@ class Download:
|
||||
|
||||
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)}'. "
|
||||
|
||||
Reference in New Issue
Block a user