encode
This commit is contained in:
parent
a716fbfec3
commit
85e9caccb0
10
np.10s.py
10
np.10s.py
|
@ -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("&", "&").replace("<", "<").replace(">", ">")
|
||||||
|
.replace("|", "|"))
|
||||||
|
|
||||||
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")
|
||||||
|
|
Loading…
Reference in New Issue