diff --git a/qml/components/AuthManager.qml b/qml/components/AuthManager.qml index a505993..446bc7f 100644 --- a/qml/components/AuthManager.qml +++ b/qml/components/AuthManager.qml @@ -44,7 +44,7 @@ Item { // Funktionen zum Token-Management function updateTokens(type, token, rtoken, expiry) { - + console.log("Update tokes") var currentUnixTime = Math.floor(new Date().getTime() / 1000) var oneWeekLater = currentUnixTime + 604800 diff --git a/qml/components/TidalApi.qml b/qml/components/TidalApi.qml index 6d41d71..3559af5 100644 --- a/qml/components/TidalApi.qml +++ b/qml/components/TidalApi.qml @@ -40,6 +40,8 @@ Item { property bool tracks: true property bool playlists: true + property bool loginTrue: false + property string playlist_track: "" property string playlist_artist: "" property string playlist_album: "" @@ -51,7 +53,6 @@ Item { property int playlist_duration: 0 property int playlist_track_id: 0 - property AuthManager authManager Python { id: pythonTidal @@ -158,11 +159,9 @@ Item { } onOAuthSuccess: { - console.log(type, token, rtoken, date) - //if (authManager) { - authManager.updateTokens(type, token, rtoken, date) - loginSuccess() - //} + console.log(type, token, rtoken, date) + authManager.updateTokens(type, token, rtoken, date) + loginSuccess() } onLoginSuccess: { @@ -179,6 +178,8 @@ Item { // Login Funktionen function getOAuth() { + console.log("Request new login") + pythonTidal.call('tidal.Tidaler.initialize', [quality]) pythonTidal.call('tidal.Tidaler.request_oauth', []) } diff --git a/qml/dialogs/OAuth.qml b/qml/dialogs/OAuth.qml index 0e0a13f..fef6fd8 100644 --- a/qml/dialogs/OAuth.qml +++ b/qml/dialogs/OAuth.qml @@ -16,6 +16,7 @@ Dialog { key: "/mail" } + WebView { width: parent.width anchors.horizontalCenter: parent.horizontalCenter @@ -27,30 +28,15 @@ Dialog { popupProvider: PopupProvider { } - onLoadingChanged: { - if (loadRequest.status === WebView.LoadSucceededStatus) { - var script = "function fillEmail() {" + - "var emailInput = document.querySelector('input[type=\"email\"]') || " + - "document.querySelector('input[name=\"email\"]') || " + - "document.querySelector('#email');" + - "if (emailInput) {" + - " emailInput.value = '" + mail.value + "';" + - " emailInput.dispatchEvent(new Event('input'));" + - " emailInput.dispatchEvent(new Event('change'));" + - "}" + - "};" + - "fillEmail();" + - "setTimeout(fillEmail, 500);"; - webView.runJavaScript(script); - } - } + } Connections { target: pythonApi onAuthUrl: { console.log(url) + Clipboard.text = mail.value webView.url = "https://" + url } diff --git a/qml/pages/Personal.qml b/qml/pages/Personal.qml index ed096d6..8c32043 100644 --- a/qml/pages/Personal.qml +++ b/qml/pages/Personal.qml @@ -81,7 +81,7 @@ Item { } Component.onCompleted: { - pythonApi.getPersonalPlaylists() + if(pythonApi.loginTrue) pythonApi.getPersonalPlaylists() } Connections @@ -99,5 +99,10 @@ Item { }) } + + onLoginSuccess: + { + pythonApi.getPersonalPlaylists() + } } } diff --git a/qml/pages/Search.qml b/qml/pages/Search.qml index 871fd57..7e587cf 100644 --- a/qml/pages/Search.qml +++ b/qml/pages/Search.qml @@ -108,12 +108,12 @@ Item { onLoginSuccess: { searchString.label = "Find" - searchString.enabled = loginTrue + searchString.enabled = pythonApi.loginTrue } onLoginFailed: { searchString.label = "Please go to the settings and login via OAuth" - searchString.enabled = loginTrue + searchString.enabled = pythonApi.loginTrue } } diff --git a/qml/pages/TrackList.qml b/qml/pages/TrackList.qml index 0b10434..d9b5525 100644 --- a/qml/pages/TrackList.qml +++ b/qml/pages/TrackList.qml @@ -162,7 +162,7 @@ SilicaListView { visible: listModel.get(model.index).type === 1 x: Theme.horizontalPageMargin - truncationMode: Fade + //truncationMode: Fade font.pixelSize: Theme.fontSizeSmall } } diff --git a/qml/pages/widgets/MiniPlayer.qml b/qml/pages/widgets/MiniPlayer.qml index 1f74665..e33b64e 100644 --- a/qml/pages/widgets/MiniPlayer.qml +++ b/qml/pages/widgets/MiniPlayer.qml @@ -102,7 +102,7 @@ DockedPanel { IconButton { id: prevButton icon.source: "image://theme/icon-m-previous" - visible: playlistManager.canPrev + //visible: playlistManager.canPrev onClicked: playlistManager.previousTrackClicked() } @@ -121,7 +121,7 @@ DockedPanel { IconButton { id: nextButton icon.source: "image://theme/icon-m-next" - visible: playlistManager.canNext + //visible: playlistManager.canNext onClicked: { mediaPlayer.blockAutoNext = true playlistManager.nextTrackClicked() diff --git a/qml/tidal.py b/qml/tidal.py index 4b41040..5b426c3 100644 --- a/qml/tidal.py +++ b/qml/tidal.py @@ -20,6 +20,8 @@ def __init__(self): self.config = None def initialize(self, quality="HIGH"): + pyotherside.send("printConsole", "Initialise tidal api") + if quality == "LOW": selected_quality = tidalapi.Quality.low elif quality == "HIGH":