mpris-status: Escape artist, album, and title metadata
This commit is contained in:
parent
674fd01d5c
commit
1ede31280f
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from textwrap import shorten
|
from textwrap import shorten
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
from xml.sax.saxutils import escape
|
||||||
|
|
||||||
from dbus.exceptions import DBusException
|
from dbus.exceptions import DBusException
|
||||||
from mpris2 import Player, get_players_uri
|
from mpris2 import Player, get_players_uri
|
||||||
@ -53,9 +54,9 @@ def format_player(player: Player, short: bool = False) -> str:
|
|||||||
"Stopped": "⏹️",
|
"Stopped": "⏹️",
|
||||||
}.get(player.PlaybackStatus, "❓") + " "
|
}.get(player.PlaybackStatus, "❓") + " "
|
||||||
|
|
||||||
artist = ",".join(metadata.artist)
|
artist = escape(",".join(metadata.artist))
|
||||||
album = metadata.album
|
album = escape(metadata.album)
|
||||||
title = metadata.title
|
title = escape(metadata.title)
|
||||||
if short:
|
if short:
|
||||||
# TODO: could be a bit more clever here to use the whole space
|
# TODO: could be a bit more clever here to use the whole space
|
||||||
artist = shorten(artist, 40, placeholder="…")
|
artist = shorten(artist, 40, placeholder="…")
|
||||||
|
Loading…
Reference in New Issue
Block a user