This commit is contained in:
Lukas Schulz 2020-12-19 22:39:56 +01:00
parent a18281bbb9
commit 1a73ea583c

17
main.py
View file

@ -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')