From 2112425979bcae285a8e70112f2cfe62e8a695ce Mon Sep 17 00:00:00 2001 From: Lukas Schulz Date: Sun, 20 Dec 2020 01:14:55 +0100 Subject: [PATCH] yes. --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 7be8a0b..3266d33 100644 --- a/main.py +++ b/main.py @@ -32,6 +32,7 @@ screen = RGBMatrix(options = options) song_name="" artist_name="" +is_playing = False token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri) @@ -41,7 +42,8 @@ def get_track(): print('getting info') sp = spotipy.Spotify(auth=token) track = sp.currently_playing() - print(track['is_playing']) + global is_playing + is_playing = track['is_playing'] global song_name song_name = track['item']['name'] global artist_name @@ -83,7 +85,7 @@ def showImage(image, offset_x = 0, offset_y = 0): def drawCanvas(): canvas = Image.new('RGB', (192, 128), color = 'black') - if(sp.currently_playing()['is_playing']): + if(is_playing): canvas.paste(get_track(),(0,96)) songinfo = ImageDraw.Draw(canvas) songinfo_offset_x = 33