This commit is contained in:
Lukas Schulz 2020-12-20 14:48:48 +01:00
parent 556df33ad8
commit d3a6b9df47

22
main.py
View file

@ -46,6 +46,10 @@ last_cover_art = Image.new('RGB',(32,32),color='white')
last_song = ''
last_artist = ''
current_cover_art = Image.new('RGB',(32,32),color='white')
current_song = ''
current_artist = ''
token = None #oauth2.SpotifyOAuth(username, scope, client_id, client_secret, redirect_uri)
#token = util.prompt_for_user_token(username, scope, client_id, client_secret, redirect_uri)
@ -84,9 +88,9 @@ 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 changeSong():
scrollDownSongInfo(song_name=last_song,artist_name=last_artist,cover_art=last_cover_art)
scrollUpSongInfo(song_name=current_song,artist_name=current_artist,cover_art=current_cover_art)
def drawCanvas():
@ -102,11 +106,17 @@ def drawCanvas():
return
if not (last_song == song_name):
change_song_scroll = threading.Thread(target=changeSong,args=(last_artist,last_song,cover_art))
change_song_scroll = threading.Thread(target=changeSong)
change_song_scroll.start()
last_song=song_name
last_song=song_name
last_artist = artist_name
last_cover_art = cover_art
global current_cover_art
current_cover_art = cover_art
global current_song
current_song = song_name
global current_artist
current_artist = artist_name
if(was_playing and not is_playing):
is_scrolling_art = True
scroll = threading.Thread(target=scrollDownSongInfo)