diff --git a/spotiplayer_pi/main.py b/spotiplayer_pi/main.py index 7e4fa27..7de28ba 100644 --- a/spotiplayer_pi/main.py +++ b/spotiplayer_pi/main.py @@ -124,7 +124,7 @@ def display_loop(api: Api, cfg: Dict): bg.paste(img, (10, 30)) draw = ImageDraw.Draw(bg) draw.text( - (145, 33), + (145, 34), "\n".join(textwrap.wrap(", ".join(data["artists"]), width=16)), font=Font1, fill=cfg["color_theme"]["text"], @@ -137,7 +137,7 @@ def display_loop(api: Api, cfg: Dict): ) w, h = bg.size - w -= 95 + w -= 90 progress_time = min( data["duration_ms"], data["progress_ms"] + int((time.time() - last_api_call) * 1000), @@ -161,23 +161,22 @@ def display_loop(api: Api, cfg: Dict): [(10, h - 20), (10 + bar_width, h - 10)], fill=cfg["color_theme"]["bar_inside"], ) - f_current_time = "{:02.0f}:{:02.0f}".format( + f_current_time = "{}:{:02.0f}".format( *divmod(progress_time // 1000, 60) ) - f_total_time = "{:02d}:{:02d}".format( + f_total_time = "{}:{:02d}".format( *divmod(data["duration_ms"] // 1000, 60) ) draw.rectangle( - [(231, 215), (320, 235)], fill=cfg["color_theme"]["background"] + [(239, 215), (320, 235)], fill=cfg["color_theme"]["background"] ) draw.text( - (232, 220), + (240, 220), f"{f_current_time}/{f_total_time}", font=Font0, fill=cfg["color_theme"]["text"], ) d.ShowImage(bg) - print(bar_width) time.sleep(cfg["refresh_interval"]) except IOError as e: