This commit is contained in:
Lukas Schulz 2020-12-20 02:14:12 +01:00
parent 036c7d29e3
commit 59eafeb282

27
main.py
View file

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