add "Nothing in the player"

This commit is contained in:
2025-06-11 17:06:59 +03:00
parent 40c5ad8dda
commit ebef3c1fe3
+7 -3
View File
@@ -90,9 +90,10 @@ def main() -> None:
full = client(GetFullUserRequest(me.id)) full = client(GetFullUserRequest(me.id))
base_bio = strip_old_track(full.full_user.about or "") base_bio = strip_old_track(full.full_user.about or "")
nbsp = "\u00a0"
if is_playing and pb is not None and pb.get("item") is not None: if is_playing and pb is not None and pb.get("item") is not None:
track_str = track_as_string(pb["item"]) track_str = track_as_string(pb["item"])
nbsp = "\u00a0"
track_str = track_str.replace(" ", nbsp) # non-breaking spaces track_str = track_str.replace(" ", nbsp) # non-breaking spaces
# Update only if changed # Update only if changed
@@ -103,8 +104,11 @@ def main() -> None:
last_track = track_str last_track = track_str
else: else:
# Nothing playing → clear any old 🎶 line # Nothing playing → clear any old 🎶 line
if last_track is not None: if last_track is not None or SINGLE_RUN:
client(UpdateProfileRequest(about=base_bio)) new_bio = (
f"{base_bio} 🎶{nbsp}Nothing{nbsp}in{nbsp}the{nbsp}player."
)
client(UpdateProfileRequest(about=new_bio))
printd("⊘ Cleared track from bio") printd("⊘ Cleared track from bio")
last_track = None last_track = None