This commit is contained in:
Lukas Schulz 2020-12-20 01:13:57 +01:00
parent 91bbabc938
commit c3eb954243

31
main.py
View file

@ -83,22 +83,23 @@ def showImage(image, offset_x = 0, offset_y = 0):
def drawCanvas(): def drawCanvas():
canvas = Image.new('RGB', (192, 128), color = 'black') canvas = Image.new('RGB', (192, 128), color = 'black')
canvas.paste(get_track(),(0,96)) if(sp.currently_playing()['is_playing']):
songinfo = ImageDraw.Draw(canvas) canvas.paste(get_track(),(0,96))
songinfo_offset_x = 33 songinfo = ImageDraw.Draw(canvas)
songinfo_offset_y = 101 songinfo_offset_x = 33
songinfo.text((songinfo_offset_x,songinfo_offset_y+10), song_name) songinfo_offset_y = 101
songinfo.text((songinfo_offset_x,songinfo_offset_y), artist_name) songinfo.text((songinfo_offset_x,songinfo_offset_y+10), song_name)
showImage(canvas) songinfo.text((songinfo_offset_x,songinfo_offset_y), artist_name)
#scrolling_text(song_name,songinfo_offset_x, songinfo_offset_y+10)
if(font.getsize(song_name)[0]>160):
x = threading.Thread(target=scrolling_text,args=(song_name,songinfo_offset_x,songinfo_offset_y+10))
x.start()
print('scrolling text started')
if(font.getsize(artist_name)[0]>160):
y = threading.Thread(target=scrolling_text,args=(artist_name,songinfo_offset_x,songinfo_offset_y))
y.start()
#scrolling_text(song_name,songinfo_offset_x, songinfo_offset_y+10)
if(font.getsize(song_name)[0]>160):
x = threading.Thread(target=scrolling_text,args=(song_name,songinfo_offset_x,songinfo_offset_y+10))
x.start()
print('scrolling text started')
if(font.getsize(artist_name)[0]>160):
y = threading.Thread(target=scrolling_text,args=(artist_name,songinfo_offset_x,songinfo_offset_y))
y.start()
showImage(canvas)
def scrolling_text(text,offset_x=0,offset_y=0): def scrolling_text(text,offset_x=0,offset_y=0):