From 64657fd1d96f291abba825541d2862c8a19c73cc Mon Sep 17 00:00:00 2001 From: Lukas Schulz Date: Sun, 20 Dec 2020 13:30:53 +0100 Subject: [PATCH] yes. --- main.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index b65cf59..3fb204d 100644 --- a/main.py +++ b/main.py @@ -97,11 +97,14 @@ def showImage(image, offset_x = 0, offset_y = 0): def drawCanvas(): canvas = Image.new('RGB', (192, 128), color = 'black') + was_playing = is_playing cover_art = get_track() if (cover_art is None): return + if(was_playing and not is_playing): + scrollDownSongInfo() 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_offset_x = 33 songinfo_offset_y = 101 @@ -120,6 +123,20 @@ def drawCanvas(): 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): scroll_frame_time = (8/2)/(font.getsize(text)[0]-160)