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)
|
||||
|
||||
async def get_track():
|
||||
def get_track():
|
||||
sp = spotipy.Spotify(auth=token)
|
||||
track = sp.currently_playing()
|
||||
print(track['is_playing'])
|
||||
|
@ -41,6 +41,7 @@ async def get_track():
|
|||
image = image.resize((32,32))
|
||||
return image
|
||||
#image.save("thumbnail.jpg","JPEG")
|
||||
screen.SetImage(thumbnail.convert('RGB'))
|
||||
|
||||
#if token:
|
||||
# sp = spotipy.Spotify(auth=token)
|
||||
|
@ -53,14 +54,14 @@ async def get_track():
|
|||
# #image.save("thumbnail.jpg","JPEG")
|
||||
#else:
|
||||
print("Can't get token for", username)
|
||||
async def main():
|
||||
thumbnail = await get_track()
|
||||
screen.SetImage(thumbnail.convert('RGB'))
|
||||
def main():
|
||||
threading.Thread(target=get_track)
|
||||
|
||||
|
||||
async def test():
|
||||
print('text')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
asyncio.run(test())
|
||||
main()
|
||||
print('text')
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue