yes.
This commit is contained in:
parent
036c7d29e3
commit
59eafeb282
1 changed files with 25 additions and 2 deletions
27
main.py
27
main.py
|
@ -34,7 +34,9 @@ artist_name=""
|
|||
|
||||
is_playing = False
|
||||
|
||||
token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
|
||||
token = None #oauth2.SpotifyOAuth(username, scope, client_id, client_secret, redirect_uri)
|
||||
|
||||
#token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
|
||||
|
||||
font = ImageFont.load_default()
|
||||
|
||||
|
@ -132,10 +134,31 @@ def scrolling_text(text,offset_x=0,offset_y=0):
|
|||
#print('scrolled '+str(i)+' px')
|
||||
|
||||
|
||||
def main():
|
||||
get_access_token()
|
||||
|
||||
def get_access_token():
|
||||
global token
|
||||
sp_oauth = spotipy.SpotifyOAuth(
|
||||
client_id,
|
||||
client_secret,
|
||||
redirect_uri,
|
||||
scope=scope,
|
||||
cache_path=cache_path,
|
||||
username=username,
|
||||
show_dialog=show_dialog
|
||||
)
|
||||
token_info = sp_oauth.get_cached_token()
|
||||
|
||||
if not token_info:
|
||||
code = sp_oauth.get_auth_response()
|
||||
token = sp_oauth.get_access_token(code, as_dict=False)
|
||||
else:
|
||||
token = token_info["access_token"]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
#main()
|
||||
main()
|
||||
print('led-matrix-viewer started')
|
||||
|
||||
while True:
|
||||
|
|
Loading…
Reference in a new issue