mpris-status: Don't fail when metadata values are None

This commit is contained in:
Adam Goldsmith 2024-11-19 12:28:32 -05:00
parent babaf53c56
commit 91952bdeaf

View File

@ -54,9 +54,9 @@ def format_player(player: Player, short: bool = False) -> str:
"Stopped": "⏹️",
}.get(player.PlaybackStatus, "") + " "
artist = escape(",".join(metadata.artist))
album = escape(metadata.album)
title = escape(metadata.title)
artist = escape(",".join(metadata.artist)) if metadata.artist else ""
album = escape(metadata.album) if metadata.album else ""
title = escape(metadata.title) if metadata.title else ""
if short:
# TODO: could be a bit more clever here to use the whole space
artist = shorten(artist, 40, placeholder="")