From 1ede31280f00e7a987d999fbf141e3784fdf9740 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Wed, 7 Jun 2023 17:37:27 -0400 Subject: [PATCH] mpris-status: Escape artist, album, and title metadata --- .config/xfce4/panel/scripts/mpris-status.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.config/xfce4/panel/scripts/mpris-status.py b/.config/xfce4/panel/scripts/mpris-status.py index caac17f..f753604 100755 --- a/.config/xfce4/panel/scripts/mpris-status.py +++ b/.config/xfce4/panel/scripts/mpris-status.py @@ -2,6 +2,7 @@ from textwrap import shorten from typing import Optional +from xml.sax.saxutils import escape from dbus.exceptions import DBusException from mpris2 import Player, get_players_uri @@ -53,9 +54,9 @@ def format_player(player: Player, short: bool = False) -> str: "Stopped": "⏹️", }.get(player.PlaybackStatus, "❓") + " " - artist = ",".join(metadata.artist) - album = metadata.album - title = metadata.title + artist = escape(",".join(metadata.artist)) + album = escape(metadata.album) + title = escape(metadata.title) if short: # TODO: could be a bit more clever here to use the whole space artist = shorten(artist, 40, placeholder="…")