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