Merge branch 'login-testing' of RemixDev/deemix into master
This commit is contained in:
commit
9fa9f663fb
|
@ -125,7 +125,7 @@ class Deezer:
|
||||||
user_data = self.gw_api_call("deezer.getUserData")
|
user_data = self.gw_api_call("deezer.getUserData")
|
||||||
if user_data["results"]["USER"]["USER_ID"] == 0:
|
if user_data["results"]["USER"]["USER_ID"] == 0:
|
||||||
self.logged_in = False
|
self.logged_in = False
|
||||||
return False
|
return 0
|
||||||
self.user = {
|
self.user = {
|
||||||
'id': user_data["results"]["USER"]["USER_ID"],
|
'id': user_data["results"]["USER"]["USER_ID"],
|
||||||
'name': user_data["results"]["USER"]["BLOG_NAME"],
|
'name': user_data["results"]["USER"]["BLOG_NAME"],
|
||||||
|
@ -133,7 +133,7 @@ class Deezer:
|
||||||
"USER"] else ""
|
"USER"] else ""
|
||||||
}
|
}
|
||||||
self.logged_in = True
|
self.logged_in = True
|
||||||
return True
|
return 1
|
||||||
|
|
||||||
def get_track_gw(self, sng_id):
|
def get_track_gw(self, sng_id):
|
||||||
if int(sng_id) < 0:
|
if int(sng_id) < 0:
|
||||||
|
|
|
@ -9,32 +9,19 @@ from os import mkdir, rmdir
|
||||||
dz = Deezer()
|
dz = Deezer()
|
||||||
settings = {}
|
settings = {}
|
||||||
|
|
||||||
def requestValidArl():
|
def login(arl):
|
||||||
while True:
|
if not dz.logged_in:
|
||||||
arl = input("Paste here your arl:")
|
return dz.login_via_arl(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()
|
|
||||||
else:
|
else:
|
||||||
arl = requestValidArl()
|
return 2
|
||||||
with open(path.join(configFolder, '.arl'), 'w') as f:
|
|
||||||
f.write(arl)
|
def getUser():
|
||||||
|
return dz.user
|
||||||
|
|
||||||
def initialize():
|
def initialize():
|
||||||
global settings
|
global settings
|
||||||
settings = initSettings()
|
settings = initSettings()
|
||||||
login()
|
return {'settings': settings}
|
||||||
return True
|
|
||||||
|
|
||||||
def shutdown(socket=None):
|
def shutdown(socket=None):
|
||||||
print(getQueue())
|
print(getQueue())
|
||||||
|
|
|
@ -3,6 +3,6 @@ mutagen
|
||||||
click
|
click
|
||||||
requests
|
requests
|
||||||
spotipy
|
spotipy
|
||||||
pywebview
|
git+git://notabug.org/RemixDev/pywebview-useragent.git
|
||||||
flask
|
flask
|
||||||
flask-socketio
|
flask-socketio
|
||||||
|
|
Loading…
Reference in New Issue