From f1f47cb0052567e6e09c3fea8719c59e36018407 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Sat, 11 Apr 2020 21:55:12 +0200 Subject: [PATCH 1/2] Testing login feature on app --- deemix/api/deezer.py | 4 ++-- deemix/app/main.py | 29 ++++++++--------------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/deemix/api/deezer.py b/deemix/api/deezer.py index 2a2f148..23d7161 100755 --- a/deemix/api/deezer.py +++ b/deemix/api/deezer.py @@ -125,7 +125,7 @@ class Deezer: user_data = self.gw_api_call("deezer.getUserData") if user_data["results"]["USER"]["USER_ID"] == 0: self.logged_in = False - return False + return 0 self.user = { 'id': user_data["results"]["USER"]["USER_ID"], 'name': user_data["results"]["USER"]["BLOG_NAME"], @@ -133,7 +133,7 @@ class Deezer: "USER"] else "" } self.logged_in = True - return True + return 1 def get_track_gw(self, sng_id): if int(sng_id) < 0: diff --git a/deemix/app/main.py b/deemix/app/main.py index 8b45f12..d1ef8cb 100644 --- a/deemix/app/main.py +++ b/deemix/app/main.py @@ -9,32 +9,19 @@ from os import mkdir, rmdir dz = Deezer() settings = {} -def requestValidArl(): - while True: - arl = input("Paste here your arl:") - if dz.login_via_arl(arl): - break - return arl - -def login(): - configFolder = localpaths.getConfigFolder() - if not path.isdir(configFolder): - mkdir(configFolder) - if path.isfile(path.join(configFolder, '.arl')): - with open(path.join(configFolder, '.arl'), 'r') as f: - arl = f.read() - if not dz.login_via_arl(arl): - arl = requestValidArl() +def login(arl): + if not dz.logged_in: + return dz.login_via_arl(arl) else: - arl = requestValidArl() - with open(path.join(configFolder, '.arl'), 'w') as f: - f.write(arl) + return 2 + +def getUser(): + return dz.user def initialize(): global settings settings = initSettings() - login() - return True + return {'settings': settings} def shutdown(socket=None): print(getQueue()) From 1408ab03e4a17e24e4b2eeb13e2a24a1de485c40 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Sat, 11 Apr 2020 22:58:31 +0200 Subject: [PATCH 2/2] Moved library to repo Added useragent to gtk (need help to implement and test other renderers) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index da5029d..6bc0e35 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,6 @@ mutagen click requests spotipy -pywebview +git+git://notabug.org/RemixDev/pywebview-useragent.git flask flask-socketio