update layout
This commit is contained in:
parent
9765756d7b
commit
0627a480f3
@ -124,7 +124,7 @@ def display_loop(api: Api, cfg: Dict):
|
|||||||
bg.paste(img, (10, 30))
|
bg.paste(img, (10, 30))
|
||||||
draw = ImageDraw.Draw(bg)
|
draw = ImageDraw.Draw(bg)
|
||||||
draw.text(
|
draw.text(
|
||||||
(145, 33),
|
(145, 34),
|
||||||
"\n".join(textwrap.wrap(", ".join(data["artists"]), width=16)),
|
"\n".join(textwrap.wrap(", ".join(data["artists"]), width=16)),
|
||||||
font=Font1,
|
font=Font1,
|
||||||
fill=cfg["color_theme"]["text"],
|
fill=cfg["color_theme"]["text"],
|
||||||
@ -137,7 +137,7 @@ def display_loop(api: Api, cfg: Dict):
|
|||||||
)
|
)
|
||||||
|
|
||||||
w, h = bg.size
|
w, h = bg.size
|
||||||
w -= 95
|
w -= 90
|
||||||
progress_time = min(
|
progress_time = min(
|
||||||
data["duration_ms"],
|
data["duration_ms"],
|
||||||
data["progress_ms"] + int((time.time() - last_api_call) * 1000),
|
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)],
|
[(10, h - 20), (10 + bar_width, h - 10)],
|
||||||
fill=cfg["color_theme"]["bar_inside"],
|
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)
|
*divmod(progress_time // 1000, 60)
|
||||||
)
|
)
|
||||||
f_total_time = "{:02d}:{:02d}".format(
|
f_total_time = "{}:{:02d}".format(
|
||||||
*divmod(data["duration_ms"] // 1000, 60)
|
*divmod(data["duration_ms"] // 1000, 60)
|
||||||
)
|
)
|
||||||
draw.rectangle(
|
draw.rectangle(
|
||||||
[(231, 215), (320, 235)], fill=cfg["color_theme"]["background"]
|
[(239, 215), (320, 235)], fill=cfg["color_theme"]["background"]
|
||||||
)
|
)
|
||||||
draw.text(
|
draw.text(
|
||||||
(232, 220),
|
(240, 220),
|
||||||
f"{f_current_time}/{f_total_time}",
|
f"{f_current_time}/{f_total_time}",
|
||||||
font=Font0,
|
font=Font0,
|
||||||
fill=cfg["color_theme"]["text"],
|
fill=cfg["color_theme"]["text"],
|
||||||
)
|
)
|
||||||
d.ShowImage(bg)
|
d.ShowImage(bg)
|
||||||
print(bar_width)
|
|
||||||
time.sleep(cfg["refresh_interval"])
|
time.sleep(cfg["refresh_interval"])
|
||||||
|
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user