yes.
This commit is contained in:
parent
c5417606d6
commit
64657fd1d9
1 changed files with 18 additions and 1 deletions
19
main.py
19
main.py
|
@ -97,11 +97,14 @@ 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')
|
||||||
|
was_playing = is_playing
|
||||||
cover_art = get_track()
|
cover_art = get_track()
|
||||||
if (cover_art is None):
|
if (cover_art is None):
|
||||||
return
|
return
|
||||||
|
if(was_playing and not is_playing):
|
||||||
|
scrollDownSongInfo()
|
||||||
if(is_playing):
|
if(is_playing):
|
||||||
canvas.paste(cover_art,(0,96))
|
canvas.paste(cover_art,(cover_art_offset_x,cover_art_offset_y))
|
||||||
songinfo = ImageDraw.Draw(canvas)
|
songinfo = ImageDraw.Draw(canvas)
|
||||||
songinfo_offset_x = 33
|
songinfo_offset_x = 33
|
||||||
songinfo_offset_y = 101
|
songinfo_offset_y = 101
|
||||||
|
@ -120,6 +123,20 @@ def drawCanvas():
|
||||||
|
|
||||||
showImage(canvas)
|
showImage(canvas)
|
||||||
|
|
||||||
|
def scrollDownSongInfo(offset_x=0,offset_y=96):
|
||||||
|
cover_art = get_track()
|
||||||
|
if (cover_art is None):
|
||||||
|
return
|
||||||
|
for i in range(32):
|
||||||
|
canvas = Image.new('RGB', (192,32), color = 'black')
|
||||||
|
canvas = canvas.paste(cover_art,(0,i))
|
||||||
|
songinfo = Image.Draw.Draw(canvas)
|
||||||
|
songinfo_offset_x = 33
|
||||||
|
songinfo.text((songinfo_offset_x,songinfo_offset_y+11+i), song_name)
|
||||||
|
songinfo.text((songinfo_offset_x,songinfo_offset_y+i), artist_name)
|
||||||
|
showImage(canvas, offset_x, offset_y)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def scrolling_text(text,offset_x=0,offset_y=0):
|
def scrolling_text(text,offset_x=0,offset_y=0):
|
||||||
scroll_frame_time = (8/2)/(font.getsize(text)[0]-160)
|
scroll_frame_time = (8/2)/(font.getsize(text)[0]-160)
|
||||||
|
|
Loading…
Reference in a new issue