yes.
This commit is contained in:
parent
305e5a7c39
commit
87fc313ab2
1 changed files with 8 additions and 0 deletions
8
main.py
8
main.py
|
@ -29,6 +29,8 @@ options.gpio_slowdown = 4
|
|||
options.brightness = 50
|
||||
screen = RGBMatrix(options = options)
|
||||
|
||||
song_name=""
|
||||
artist_name=""
|
||||
|
||||
|
||||
token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
|
||||
|
@ -39,6 +41,10 @@ def get_track():
|
|||
sp = spotipy.Spotify(auth=token)
|
||||
track = sp.currently_playing()
|
||||
print(track['is_playing'])
|
||||
global song_name
|
||||
song_name = track['item']['name']
|
||||
global artist_name
|
||||
artist_name = track['item']['artists'][0]['name']
|
||||
print(track['item']['name'] + ' - ' + track['item']['artists'][0]['name'])
|
||||
print('getting image')
|
||||
image_url = track['item']['album']['images'][0]['url']
|
||||
|
@ -77,6 +83,8 @@ def showImage(image, offset_x = 0, offset_y = 0):
|
|||
def drawCanvas():
|
||||
canvas = Image.new('RGB', (192, 128), color = 'red')
|
||||
canvas.paste(get_track(),(0,0))
|
||||
songinfo = ImageDraw.Draw(canvas)
|
||||
songinfo.text((10,10), song_name)
|
||||
showImage(canvas)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue