This commit is contained in:
Lukas Schulz 2020-12-20 14:40:45 +01:00
parent 41e04e2795
commit 556df33ad8

11
main.py
View file

@ -44,6 +44,7 @@ cover_art_offset_y = 96
last_cover_art = Image.new('RGB',(32,32),color='white')
last_song = ''
last_artist = ''
token = None #oauth2.SpotifyOAuth(username, scope, client_id, client_secret, redirect_uri)
@ -83,12 +84,15 @@ def showImage(image, offset_x = 0, offset_y = 0):
r, g, b = image.getpixel((x, y))
screen.SetPixel(x+offset_x,y+offset_y,r,g,b)
def changeSong(newCover, oldArtist, oldTitle):
scrollDownSongInfo(song_name=oldTitle,artist_name=oldArtist)
scrollUpSongInfo(cover_art=newCover)
def drawCanvas():
canvas = Image.new('RGB', (192, 128), color = 'black')
global last_song
global last_artist
was_playing = is_playing
cover_art = get_track()
@ -96,8 +100,11 @@ def drawCanvas():
global is_scrolling_art
if (cover_art is None):
return
if not (last_song == song_name):
print('text')
change_song_scroll = threading.Thread(target=changeSong,args=(last_artist,last_song,cover_art))
change_song_scroll.start()
last_song=song_name
last_cover_art = cover_art
if(was_playing and not is_playing):