summaryrefslogtreecommitdiff
path: root/tidal_dl_ng/gui.py
diff options
context:
space:
mode:
authorRobert Honz <exislow+github@gmail.com>2024-11-13 13:26:46 +0100
committerRobert Honz <exislow+github@gmail.com>2024-11-13 13:26:46 +0100
commit5f9cc39ba736b0e9aa87da8b6cd27b67acf250fc (patch)
tree84c32533ae4fd10194592fad03389282b5d48299 /tidal_dl_ng/gui.py
parent618b16257b6f398345bac467aa2706f7385ff577 (diff)
downloadtidal-dl-ng-5f9cc39ba736b0e9aa87da8b6cd27b67acf250fc.tar.gz
✨ GUI login updated to device mode.
Diffstat (limited to 'tidal_dl_ng/gui.py')
-rw-r--r--tidal_dl_ng/gui.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/tidal_dl_ng/gui.py b/tidal_dl_ng/gui.py
index 4cc3150..6c5429f 100644
--- a/tidal_dl_ng/gui.py
+++ b/tidal_dl_ng/gui.py
@@ -5,6 +5,8 @@ from collections.abc import Callable, Sequence
from PySide6.QtGui import QStandardItem
from requests.exceptions import HTTPError
+from tidalapi.session import LinkLogin
+from tidalapi.types import JsonObj
from tidal_dl_ng import __version__, update_available
from tidal_dl_ng.dialog import DialogLogin, DialogPreferences, DialogVersion
@@ -131,15 +133,18 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
hint: str = "After you have finished the TIDAL login via web browser click the 'OK' button."
while not result:
- login, future = self.tidal.session.login_oauth()
-
- d_login: DialogLogin = DialogLogin(url_login=login.verification_uri_complete, hint=hint, expires_in=login.expires_in, parent=self)
+ json_obj: JsonObj = self.tidal.session._login_with_link()
+ link_login: LinkLogin = LinkLogin(json_obj)
+ d_login: DialogLogin = DialogLogin(
+ url_login=link_login.verification_uri_complete,
+ hint=hint,
+ expires_in=link_login.expires_in,
+ parent=self,
+ )
if d_login.return_code == 1:
try:
- future.result()
- token: dict[str, str | int] = self.tidal.session.pkce_get_auth_token(url_redirect)
- self.tidal.session.process_auth_token(token)
+ self.tidal.session._process_link_login(json_obj)
self.tidal.login_finalize()
result = True