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():
canvas = Image.new('RGB', (192, 128), color = 'black')
canvas.paste(get_track(),(0,96))
songinfo = ImageDraw.Draw(canvas)
songinfo_offset_x = 33
songinfo_offset_y = 101
songinfo.text((songinfo_offset_x,songinfo_offset_y+10), song_name)
songinfo.text((songinfo_offset_x,songinfo_offset_y), artist_name)
showImage(canvas)
#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()
if(sp.currently_playing()['is_playing']):
canvas.paste(get_track(),(0,96))
songinfo = ImageDraw.Draw(canvas)
songinfo_offset_x = 33
songinfo_offset_y = 101
songinfo.text((songinfo_offset_x,songinfo_offset_y+10), song_name)
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()
showImage(canvas)
def scrolling_text(text,offset_x=0,offset_y=0):