forked from Wobbl/Wobuzz
MPRIS: Got everything necessary working. (I think.)
This commit is contained in:
parent
f23530628c
commit
1f149a25a3
10 changed files with 333 additions and 58 deletions
|
@ -1,9 +1,6 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from jeepney import Header, MessageType, Endianness, MessageFlag, new_method_return
|
||||
from jeepney.bus_messages import message_bus
|
||||
from jeepney.io.blocking import open_dbus_connection
|
||||
from jeepney.wrappers import new_header
|
||||
from jeepney import new_signal
|
||||
|
||||
from .utils import *
|
||||
|
||||
|
@ -13,25 +10,31 @@ class DBusProperties(DBusInterface):
|
|||
body = ({},)
|
||||
return body
|
||||
|
||||
def properties_changed(self, interface: str):
|
||||
def properties_changed(self, interface: str, prop_name: str):
|
||||
body = None
|
||||
|
||||
if interface == MPRIS_ROOT_INTERFACE:
|
||||
body = (MPRIS_ROOT_INTERFACE,) + self.server.root_interface.get_all()
|
||||
prop = getattr(self.server.root_interface, prop_name)(None)
|
||||
|
||||
body = (MPRIS_ROOT_INTERFACE,) + ({prop_name: prop}, [])
|
||||
|
||||
elif interface == MPRIS_PLAYER_INTERFACE:
|
||||
body = (MPRIS_PLAYER_INTERFACE,) + self.server.player_interface.get_all()
|
||||
prop = getattr(self.server.player_interface, prop_name)(None)
|
||||
|
||||
signature = "" if body is None else "sa{sv}"
|
||||
body = (MPRIS_PLAYER_INTERFACE,) + ({prop_name: prop}, [])
|
||||
|
||||
signature = "" if body is None else "sa{sv}as"
|
||||
|
||||
msg = new_signal(
|
||||
self.server.bus_address.with_interface("org.freedesktop.DBus"),
|
||||
self.server.bus_address.with_interface(PROPERTIES_INTERFACE),
|
||||
"PropertiesChanged",
|
||||
signature,
|
||||
body
|
||||
)
|
||||
self.server.bus.send(msg)
|
||||
|
||||
# ======== Methods ========
|
||||
|
||||
def Get(self, msg: Message):
|
||||
interface_name = msg.body[0]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue