Код: Выделить всё
from PySide6.QtDBus import QDBusInterface, QDBusConnection
BUS = QDBusConnection.sessionBus()
OBJ = "/org/mpris/MediaPlayer2"
IF_PLAYER = "org.mpris.MediaPlayer2.Player"
def find_first_mpris_service():
bus_iface = QDBusInterface(
"org.freedesktop.DBus",
"/org/freedesktop/DBus",
"org.freedesktop.DBus",
BUS
)
reply = bus_iface.call("ListNames")
for name in reply.arguments()[0]:
if name.startswith("org.mpris.MediaPlayer2."):
return name
return None
mpris = find_first_mpris_service()
iface = QDBusInterface(
mpris,
OBJ,
"org.freedesktop.DBus.Properties",
BUS
)
reply = iface.call("Get", IF_PLAYER, "Metadata")
print(type(reply.arguments()[0]))
Код: Выделить всё
a{sv}
Заранее спасибо за совет!
Подробнее здесь: https://stackoverflow.com/questions/797 ... ython-dict