yes.
This commit is contained in:
parent
a18281bbb9
commit
1a73ea583c
1 changed files with 9 additions and 8 deletions
17
main.py
17
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)
|
token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
|
||||||
|
|
||||||
async def get_track():
|
def get_track():
|
||||||
sp = spotipy.Spotify(auth=token)
|
sp = spotipy.Spotify(auth=token)
|
||||||
track = sp.currently_playing()
|
track = sp.currently_playing()
|
||||||
print(track['is_playing'])
|
print(track['is_playing'])
|
||||||
|
@ -41,6 +41,7 @@ async def get_track():
|
||||||
image = image.resize((32,32))
|
image = image.resize((32,32))
|
||||||
return image
|
return image
|
||||||
#image.save("thumbnail.jpg","JPEG")
|
#image.save("thumbnail.jpg","JPEG")
|
||||||
|
screen.SetImage(thumbnail.convert('RGB'))
|
||||||
|
|
||||||
#if token:
|
#if token:
|
||||||
# sp = spotipy.Spotify(auth=token)
|
# sp = spotipy.Spotify(auth=token)
|
||||||
|
@ -53,14 +54,14 @@ async def get_track():
|
||||||
# #image.save("thumbnail.jpg","JPEG")
|
# #image.save("thumbnail.jpg","JPEG")
|
||||||
#else:
|
#else:
|
||||||
print("Can't get token for", username)
|
print("Can't get token for", username)
|
||||||
async def main():
|
def main():
|
||||||
thumbnail = await get_track()
|
threading.Thread(target=get_track)
|
||||||
screen.SetImage(thumbnail.convert('RGB'))
|
|
||||||
|
|
||||||
async def test():
|
|
||||||
print('text')
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
asyncio.run(main())
|
main()
|
||||||
asyncio.run(test())
|
print('text')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue