Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import dbus
- class vol():
- def __init__(self):
- self.volume = 0
- self.bus = dbus.SessionBus()
- self.bus_obj = \
- 'com.nokia.mafw.renderer.Mafw-Gst-Renderer-Plugin.gstrenderer'
- self.bus_path = '/com/nokia/mafw/renderer/gstrenderer'
- self.bus_addr = 'com.nokia.mafw.extension'
- self.dconn = self.bus.get_object(self.bus_obj,
- self.bus_path,
- introspect=False)
- self.ifc = dbus.Interface(self.dconn, dbus_interface=self.bus_addr)
- def set_volume(self, vol):
- if (vol < -1) or (vol > 100):
- return False
- self.volume = vol
- self._volume = dbus.UInt32(self.volume, variant_level=1)
- self.ifc.set_extension_property('volume', self._volume)
- return self.volume
- def get_volume(self):
- self._volume = self.ifc.get_extension_property('volume')
- self.volume = int(self._volume[1])
- return self.volume
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement