Testing login feature on app

This commit is contained in:
RemixDev 2020-04-11 21:55:12 +02:00
parent 497186dba9
commit f1f47cb005
2 changed files with 10 additions and 23 deletions

View File

@ -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:

View File

@ -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())