yes.
This commit is contained in:
parent
6104c066cf
commit
0c78005c07
1 changed files with 15 additions and 3 deletions
18
main.py
18
main.py
|
@ -31,7 +31,7 @@ screen = RGBMatrix(options = options) #pygame.display.set_mode(self.size, self.f
|
|||
|
||||
token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
|
||||
|
||||
if token:
|
||||
async def get_track():
|
||||
sp = spotipy.Spotify(auth=token)
|
||||
track = sp.currently_playing()
|
||||
print(track['is_playing'])
|
||||
|
@ -39,8 +39,20 @@ if token:
|
|||
imageString = requests.get(track['item']['album']['images'][0]['url'])
|
||||
image = Image.open(BytesIO(imageString.content))
|
||||
image = image.resize((32,32))
|
||||
return image
|
||||
#image.save("thumbnail.jpg","JPEG")
|
||||
else:
|
||||
|
||||
#if token:
|
||||
# sp = spotipy.Spotify(auth=token)
|
||||
# track = sp.currently_playing()
|
||||
# print(track['is_playing'])
|
||||
# print(track['item']['name'] + ' - ' + track['item']['artists'][0]['name'])
|
||||
# imageString = requests.get(track['item']['album']['images'][0]['url'])
|
||||
# image = Image.open(BytesIO(imageString.content))
|
||||
# image = image.resize((32,32))
|
||||
# #image.save("thumbnail.jpg","JPEG")
|
||||
#else:
|
||||
print("Can't get token for", username)
|
||||
while(True):
|
||||
screen.SetImage(image.convert('RGB'))
|
||||
screen.SetImage(get_track().convert('RGB'))
|
||||
print("Text")
|
||||
|
|
Loading…
Reference in a new issue