This commit is contained in:
xenia 2021-06-26 00:33:54 -04:00
parent a716fbfec3
commit 85e9caccb0
1 changed files with 7 additions and 3 deletions

View File

@ -6,6 +6,10 @@ import sys
bus = SessionBus() bus = SessionBus()
all_names = bus.get("org.freedesktop.DBus", "/org/freedesktop/DBus").ListNames() all_names = bus.get("org.freedesktop.DBus", "/org/freedesktop/DBus").ListNames()
def writepart(s):
sys.stdout.write(s.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
.replace("|", "&#124;"))
for name in all_names: for name in all_names:
if name.startswith("org.mpris.MediaPlayer2."): if name.startswith("org.mpris.MediaPlayer2."):
mpris = bus.get(name, "/org/mpris/MediaPlayer2") mpris = bus.get(name, "/org/mpris/MediaPlayer2")
@ -27,15 +31,15 @@ for name in all_names:
album = None album = None
if artist is not None: if artist is not None:
sys.stdout.write(artist) writepart(artist)
if title is not None: if title is not None:
if artist is not None: if artist is not None:
sys.stdout.write(" - ") sys.stdout.write(" - ")
sys.stdout.write(title) writepart(title)
if album is not None: if album is not None:
if artist is not None or title is not None: if artist is not None or title is not None:
sys.stdout.write(" / ") sys.stdout.write(" / ")
sys.stdout.write(album) writepart(album)
if artist is not None or album is not None or title is not None: if artist is not None or album is not None or title is not None:
sys.stdout.write(" | iconName=multimedia-audio-player-symbolic\n") sys.stdout.write(" | iconName=multimedia-audio-player-symbolic\n")