Python dbus.Dictionary() Examples

The following are 30 code examples of dbus.Dictionary(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module dbus , or try the search function .
Example #1
Source File: py_spotify_listener.py    From polybar-spotify-controls with MIT License 7 votes vote down vote up
def unwrap(val):
    if isinstance(val, dbus.ByteArray):
        return "".join([str(x) for x in val])
    if isinstance(val, (dbus.Array, list, tuple)):
        return [unwrap(x) for x in val]
    if isinstance(val, (dbus.Dictionary, dict)):
        return dict([(unwrap(x), unwrap(y)) for x, y in val.items()])
    if isinstance(val, (dbus.Signature, dbus.String)):
        return str(val)
    if isinstance(val, dbus.Boolean):
        return bool(val)
    if isinstance(val, (dbus.Int16, dbus.UInt16, dbus.Int32, dbus.UInt32, dbus.Int64, dbus.UInt64)):
        return int(val)
    if isinstance(val, dbus.Byte):
        return bytes([int(val)])
    return val 
Example #2
Source File: networkmanayer.py    From my-weather-indicator with MIT License 6 votes vote down vote up
def unwrap(self, val):
        if isinstance(val, dbus.ByteArray):
            return "".join([str(x) for x in val])
        if isinstance(val, (dbus.Array, list, tuple)):
            return [self.unwrap(x) for x in val]
        if isinstance(val, (dbus.Dictionary, dict)):
            return dict([(self.unwrap(x), self.unwrap(y)) for x, y in val.items()])
        if isinstance(val, dbus.ObjectPath):
            if val.startswith('/org/freedesktop/NetworkManager/'):
                classname = val.split('/')[4]
                classname = {
                    'Settings': 'Connection',
                    'Devices': 'Device',
                }.get(classname, classname)
                return globals()[classname](val)
        if isinstance(val, (dbus.Signature, dbus.String)):
            return unicode(val)
        if isinstance(val, dbus.Boolean):
            return bool(val)
        if isinstance(val, (dbus.Int16, dbus.UInt16, dbus.Int32, dbus.UInt32, dbus.Int64, dbus.UInt64)):
            return int(val)
        if isinstance(val, dbus.Byte):
            return bytes([int(val)])
        return val 
Example #3
Source File: mpris2.py    From FeelUOwn with GNU General Public License v3.0 6 votes vote down vote up
def get_player_properties(self):
        return dbus.Dictionary({
            'Metadata': self._metadata,
            'Rate': 1.0,
            'MinimumRate': 1.0,
            'MaximumRate': 1.0,
            'CanGoNext': True,
            'CanGoPrevious': True,
            'CanControl': True,
            'CanSeek': True,
            'CanPause': True,
            'CanPlay': True,
            'Position': self._old_position,
            # 'LoopStatus': 'Playlist',
            'PlaybackStatus': to_dbus_playback_status(self._app.player.state),
            'Volume': to_dbus_volume(self._app.player.volume),
        }, signature='sv', variant_level=2)

    # ##########################
    # implement mpris2 interface
    # ########################## 
Example #4
Source File: localGATT.py    From python-bluezero with MIT License 6 votes vote down vote up
def Set(self, interface_name, property_name, value, *args, **kwargs):
        """Standard D-Bus API for setting a property value"""

        try:
            iface_props = self.props[interface_name]
        except KeyError:
            raise dbus.exceptions.DBusException(
                'no such interface ' + interface_name,
                name=self.interface + '.UnknownInterface')

        if property_name not in iface_props:
            raise dbus.exceptions.DBusException(
                'no such property ' + property_name,
                name=self.interface + '.UnknownProperty')

        iface_props[property_name] = value

        self.PropertiesChanged(interface_name,
                               dbus.Dictionary({property_name: value},
                                               signature='sv'),
                               dbus.Array([], signature='s')) 
Example #5
Source File: nmcli.py    From baremetal-deploy with Apache License 2.0 6 votes vote down vote up
def dict_to_string(self, d):
        # Try to trivially translate a dictionary's elements into nice string
        # formatting.
        dstr = ""
        for key in d:
            val = d[key]
            str_val = ""
            add_string = True
            if isinstance(val, dbus.Array):
                for elt in val:
                    if isinstance(elt, dbus.Byte):
                        str_val += "%s " % int(elt)
                    elif isinstance(elt, dbus.String):
                        str_val += "%s" % elt
            elif isinstance(val, dbus.Dictionary):
                dstr += self.dict_to_string(val)
                add_string = False
            else:
                str_val = val
            if add_string:
                dstr += "%s: %s\n" % (key, str_val)
        return dstr 
Example #6
Source File: dbuswpasupplicant.py    From pywificontrol with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def create_interface(self, interface, bridge_interface=None,
                         driver=None, config_file=None):
        try:
            wpa_interface = self.__get_interface()
        except dbus.exceptions.DBusException as error:
            raise ServiceError(error)
        else:
            args = {"Ifname": interface}
            if bridge_interface is not None:
                args["BridgeIfname"] = bridge_interface
            if driver is not None:
                args["Driver"] = driver
            if config_file is not None:
                args["ConfigFile"] = config_file
            try:
                return wpa_interface.CreateInterface(dbus.Dictionary(args, 'sv'))
            except dbus.exceptions.DBusException as error:
                raise InterfaceError(error) 
Example #7
Source File: test_bt_bus.py    From bt-manager with GNU General Public License v3.0 6 votes vote down vote up
def test_all(self):

        val = [1, 2, 3, 4, 5]
        self.assertEqual(bt_manager.interface.translate_to_dbus_type(dbus.Array, val),  # noqa
                         dbus.Array(val))
        val = -1
        self.assertEqual(bt_manager.interface.translate_to_dbus_type(dbus.Int32, val),  # noqa
                         dbus.Int32(val))
        val = 1
        self.assertEqual(bt_manager.interface.translate_to_dbus_type(dbus.UInt32, val),  # noqa
                         dbus.UInt32(val))
        val = 'Test'
        self.assertEqual(bt_manager.interface.translate_to_dbus_type(dbus.String, val),  # noqa
                         dbus.String(val))
        val = {'Hello': 1}
        self.assertEqual(bt_manager.interface.translate_to_dbus_type(dbus.Dictionary,  # noqa
                                                           val),
                         dbus.Dictionary(val))
        val = 'True'
        self.assertEqual(bt_manager.interface.translate_to_dbus_type(dbus.Boolean, val),  # noqa
                         dbus.Boolean(True))
        val = 'False'
        self.assertEqual(bt_manager.interface.translate_to_dbus_type(dbus.Boolean, val),  # noqa
                         dbus.Boolean(False)) 
Example #8
Source File: advertisement.py    From cputemp with MIT License 5 votes vote down vote up
def add_service_data(self, uuid, data):
        if not self.service_data:
            self.service_data = dbus.Dictionary({}, signature="sv")
        self.service_data[uuid] = dbus.Array(data, signature="y") 
Example #9
Source File: advertisement.py    From cputemp with MIT License 5 votes vote down vote up
def get_properties(self):
        properties = dict()
        properties["Type"] = self.ad_type

        if self.local_name is not None:
            properties["LocalName"] = dbus.String(self.local_name)

        if self.service_uuids is not None:
            properties["ServiceUUIDs"] = dbus.Array(self.service_uuids,
                                                    signature='s')
        if self.solicit_uuids is not None:
            properties["SolicitUUIDs"] = dbus.Array(self.solicit_uuids,
                                                    signature='s')
        if self.manufacturer_data is not None:
            properties["ManufacturerData"] = dbus.Dictionary(
                self.manufacturer_data, signature='qv')

        if self.service_data is not None:
            properties["ServiceData"] = dbus.Dictionary(self.service_data,
                                                        signature='sv')
        if self.include_tx_power is not None:
            properties["IncludeTxPower"] = dbus.Boolean(self.include_tx_power)

        if self.local_name is not None:
            properties["LocalName"] = dbus.String(self.local_name)

        return {LE_ADVERTISEMENT_IFACE: properties} 
Example #10
Source File: mpris2.py    From FeelUOwn with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, app, bus):
        super().__init__(bus, ObjectPath)
        self._app = app
        self._metadata = dbus.Dictionary({}, signature='sv', variant_level=1)
        self._old_position = dbus.Int64(0) 
Example #11
Source File: mpris2.py    From FeelUOwn with GNU General Public License v3.0 5 votes vote down vote up
def _update_song_props(self, song):
        artist = [', '.join((e.name for e in song.artists))] or ['Unknown']
        self._metadata.update(dbus.Dictionary({
            # make xesam:artist a one-element list to compat with KDE
            # KDE will not update artist field if the length>=2
            'xesam:artist': artist,
            'xesam:url': song.url,
            'mpris:length': dbus.Int64(song.duration*1000),
            'mpris:trackid': to_track_id(song),
            'mpris:artUrl': song.album.cover if song.album else '',
            'xesam:album': song.album_name,
            'xesam:title': song.title,
        }, signature='sv'))
        changed_properties = dbus.Dictionary({'Metadata': self._metadata})
        self.PropertiesChanged(PlayerInterface, changed_properties, []) 
Example #12
Source File: upower.py    From cpu-g with GNU General Public License v3.0 5 votes vote down vote up
def convert(dbus_obj):
    """Converts dbus_obj from dbus type to python type.
    :param dbus_obj: dbus object.
    :returns: dbus_obj in python type.
    """
    _isinstance = partial(isinstance, dbus_obj)
    ConvertType = namedtuple('ConvertType', 'pytype dbustypes')

    pyint = ConvertType(int, (dbus.Byte, dbus.Int16, dbus.Int32, dbus.Int64,
                              dbus.UInt16, dbus.UInt32, dbus.UInt64))
    pybool = ConvertType(bool, (dbus.Boolean, ))
    pyfloat = ConvertType(float, (dbus.Double, ))
    pylist = ConvertType(lambda _obj: list(map(convert, dbus_obj)),
                         (dbus.Array, ))
    pytuple = ConvertType(lambda _obj: tuple(map(convert, dbus_obj)),
                          (dbus.Struct, ))
    types_str = (dbus.ObjectPath, dbus.Signature, dbus.String)
    pystr = ConvertType(str, types_str)

    pydict = ConvertType(
        lambda _obj: dict(zip(map(convert, dbus_obj.keys()),
                              map(convert, dbus_obj.values())
                              )
                          ),
        (dbus.Dictionary, )
    )

    for conv in (pyint, pybool, pyfloat, pylist, pytuple, pystr, pydict):
        if any(map(_isinstance, conv.dbustypes)):
            return conv.pytype(dbus_obj)
        return dbus_obj 
Example #13
Source File: advertisement.py    From python-bluezero with MIT License 5 votes vote down vote up
def GetAll(self, interface_name):
        """Return the advertisement properties.

        This method is registered with the D-Bus at
        ``org.freedesktop.DBus.Properties``

        :param interface: interface to get the properties of.

        The interface must be ``org.bluez.LEAdvertisement1`` otherwise an
        exception is raised.
        """
        if interface_name != constants.LE_ADVERTISEMENT_IFACE:
            raise InvalidArgsException()

        response = {}
        response['Type'] = self.props[interface_name]['Type']
        if self.props[interface_name]['ServiceUUIDs'] is not None:
            response['ServiceUUIDs'] = dbus.Array(
                self.props[interface_name]['ServiceUUIDs'],
                signature='s')
        if self.props[interface_name]['ServiceData'] is not None:
            response['ServiceData'] = dbus.Dictionary(
                self.props[interface_name]['ServiceData'],
                signature='sv')
        if self.props[interface_name]['ManufacturerData'] is not None:
            response['ManufacturerData'] = dbus.Dictionary(
                self.props[interface_name]['ManufacturerData'],
                signature='qv')
        if self.props[interface_name]['SolicitUUIDs'] is not None:
            response['SolicitUUIDs'] = dbus.Array(
                self.props[interface_name]['SolicitUUIDs'],
                signature='s')
        response['IncludeTxPower'] = dbus.Boolean(
            self.props[interface_name]['IncludeTxPower'])

        return response 
Example #14
Source File: peripheral.py    From python-bluezero with MIT License 5 votes vote down vote up
def get_properties(self):
        """Return a dictionary of the advert properties.

        The dictionary has the following keys:

        - Type: the advertisement type.
        - ServiceUUIDS: UUIDs of services to advertise
        - SolicitUUIDS:
        - ManufacturerData: dictionary of manufacturer data
        - ServiceData: dictionary of service data
        - IncludeTxPower:

        """
        properties = dict()
        properties['Type'] = self.ad_type
        if self.service_uuids is not None:
            properties['ServiceUUIDs'] = dbus.Array(self.service_uuids,
                                                    signature='s')
        if self.solicit_uuids is not None:
            properties['SolicitUUIDs'] = dbus.Array(self.solicit_uuids,
                                                    signature='s')
        if self.manufacturer_data is not None:
            properties['ManufacturerData'] = dbus.Dictionary(
                self.manufacturer_data, signature='qay')
        if self.service_data is not None:
            properties['ServiceData'] = dbus.Dictionary(self.service_data,
                                                        signature='say')
        if self.include_tx_power is not None:
            properties['IncludeTxPower'] = dbus.Boolean(self.include_tx_power)
        return {constants.LE_ADVERTISEMENT_IFACE: properties} 
Example #15
Source File: localGATT.py    From python-bluezero with MIT License 5 votes vote down vote up
def Set(self, interface_name, property_name, value, *args, **kwargs):
        """Standard D-Bus API for setting a property value"""

        if property_name not in self.props[constants.GATT_CHRC_IFACE]:
            raise dbus.exceptions.DBusException(
                'no such property ' + property_name,
                name=constants.GATT_CHRC_IFACE + '.UnknownProperty')

        self.props[constants.GATT_CHRC_IFACE][property_name] = value

        return self.PropertiesChanged(interface_name,
                                      dbus.Dictionary({property_name: value},
                                                      signature='sv'),
                                      dbus.Array([], signature='s')) 
Example #16
Source File: localGATT.py    From python-bluezero with MIT License 5 votes vote down vote up
def Set(self, interface_name, property_name, value, *args, **kwargs):
        """Standard D-Bus API for setting a property value"""

        if property_name not in self.props[constants.GATT_DESC_IFACE]:
            raise dbus.exceptions.DBusException(
                'no such property ' + property_name,
                name=constants.GATT_DESC_IFACE + '.UnknownProperty')

        self.props[interface_name][property_name] = value

        return self.PropertiesChanged(interface_name,
                                      dbus.Dictionary({property_name: value},
                                                      signature='sv'),
                                      dbus.Array([], signature='s')) 
Example #17
Source File: ipaddress.py    From my-weather-indicator with MIT License 5 votes vote down vote up
def convert(dbus_obj):
    """Converts dbus_obj from dbus type to python type.
    :param dbus_obj: dbus object.
    :returns: dbus_obj in python type.
    """
    _isinstance = partial(isinstance, dbus_obj)
    ConvertType = namedtuple('ConvertType', 'pytype dbustypes')

    pyint = ConvertType(int, (dbus.Byte, dbus.Int16, dbus.Int32, dbus.Int64,
                              dbus.UInt16, dbus.UInt32, dbus.UInt64))
    pybool = ConvertType(bool, (dbus.Boolean, ))
    pyfloat = ConvertType(float, (dbus.Double, ))
    pylist = ConvertType(lambda _obj: list(map(convert, dbus_obj)),
                         (dbus.Array, ))
    pytuple = ConvertType(lambda _obj: tuple(map(convert, dbus_obj)),
                          (dbus.Struct, ))
    types_str = (dbus.ObjectPath, dbus.Signature, dbus.String)
    pystr = ConvertType(str, types_str)

    pydict = ConvertType(
        lambda _obj: dict(list(zip(list(map(convert, dbus_obj.keys())),
                                   list(map(convert, dbus_obj.values()))
                                   ))
                          ),
        (dbus.Dictionary, )
    )

    for conv in (pyint, pybool, pyfloat, pylist, pytuple, pystr, pydict):
        if any(map(_isinstance, conv.dbustypes)):
            return conv.pytype(dbus_obj)
    else:
        return dbus_obj 
Example #18
Source File: other_nm.py    From python-eduvpn-client with GNU General Public License v3.0 5 votes vote down vote up
def base_to_python(val):
        if isinstance(val, dbus.ByteArray):
            return "".join([str(x) for x in val])
        if isinstance(val, (dbus.Array, list, tuple)):
            return [fixups.base_to_python(x) for x in val]
        if isinstance(val, (dbus.Dictionary, dict)):
            return dict([(fixups.base_to_python(x), fixups.base_to_python(y)) for x, y in val.items()])
        if isinstance(val, dbus.ObjectPath):
            for obj in (NetworkManager, Settings, AgentManager):
                if val == obj.object_path:
                    return obj
            if val.startswith('/org/freedesktop/NetworkManager/'):
                classname = val.split('/')[4]
                classname = {
                    'Settings': 'Connection',
                    'Devices': 'Device',
                }.get(classname, classname)
                try:
                    return globals()[classname](val)
                except ObjectVanished:
                    return None
            if val == '/':
                return None
        if isinstance(val, (dbus.Signature, dbus.String)):
            return six.text_type(val)
        if isinstance(val, dbus.Boolean):
            return bool(val)
        if isinstance(val, (dbus.Int16, dbus.UInt16, dbus.Int32, dbus.UInt32, dbus.Int64, dbus.UInt64)):
            return int(val)
        if isinstance(val, dbus.Byte):
            return six.int2byte(int(val))
        return val 
Example #19
Source File: advertisement.py    From cputemp with MIT License 5 votes vote down vote up
def add_manufacturer_data(self, manuf_code, data):
        if not self.manufacturer_data:
            self.manufacturer_data = dbus.Dictionary({}, signature="qv")
        self.manufacturer_data[manuf_code] = dbus.Array(data, signature="y") 
Example #20
Source File: client.py    From pomodoroTasks2 with GNU General Public License v3.0 5 votes vote down vote up
def doCommand(self,comm):
        self.com = comm 
        #Quit daemon and systray
        if self.com == "quit":
            #close systray when closing the daemon as well
            self.interface.do_quit(True)
            print("pomodoro daemon halted")
        # Show the change task gui
        elif self.com == "systray":
            # use busConnection better than bus = dbus.SessionBus() to work with systemd for example
            self.bus = dbus.bus.BusConnection(self.dbus_path)
            self.session_bus = self.bus.get_object('org.liloman.pomodoro.systray', "/systray")
            systray = dbus.Interface(self.session_bus, "org.liloman.pomodoro.systrayInterface")
            systray.show_change_task()
        # Start a uuid task
        elif self.com == "do_start":
            if len(sys.argv) != 3:
                print("must pass a valid uuid")
                sys.exit(1)
            dic = dbus.Dictionary({'uuid': sys.argv[2] , 'resume': 'No'  } , signature = 'ss' )
            try:
                print ("reply:"+self.interface.do_start(dic)[0])
            except:
                print("Incorrect uuid:"+sys.argv[2]+" .The task couldn't be started")
        # Do any other command
        else:
            print(u''.join(self.interface.do_fsm(self.com)[0]).encode('utf-8').strip()) 
Example #21
Source File: NetworkManager.py    From AstroBox with GNU Affero General Public License v3.0 5 votes vote down vote up
def base_to_python(val):
				if isinstance(val, dbus.ByteArray):
						return "".join([str(x) for x in val])
				if isinstance(val, (dbus.Array, list, tuple)):
						return [fixups.base_to_python(x) for x in val]
				if isinstance(val, (dbus.Dictionary, dict)):
						return dict([(fixups.base_to_python(x), fixups.base_to_python(y)) for x,y in val.items()])
				if isinstance(val, dbus.ObjectPath):
						for obj in (NetworkManager, Settings, AgentManager):
								if val == obj.object_path:
										return obj
						if val.startswith('/org/freedesktop/NetworkManager/'):
								classname = val.split('/')[4]
								classname = {
									 'Settings': 'Connection',
									 'Devices': 'Device',
								}.get(classname, classname)
								return globals()[classname](val)
						if val == '/':
								return None
				if isinstance(val, (dbus.Signature, dbus.String)):
						return six.text_type(val)
				if isinstance(val, dbus.Boolean):
						return bool(val)
				if isinstance(val, (dbus.Int16, dbus.UInt16, dbus.Int32, dbus.UInt32, dbus.Int64, dbus.UInt64)):
						return int(val)
				if isinstance(val, dbus.Byte):
						return six.int2byte(int(val))
				return val 
Example #22
Source File: dbuswpasupplicant.py    From pywificontrol with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def add_network(self, network):
        interface = self.__get_interface()
        try:
            return interface.AddNetwork(dbus.Dictionary(network, 'sv'))
        except dbus.exceptions.DBusException as error:
            raise ServiceError(error) 
Example #23
Source File: dbuswpasupplicant.py    From pywificontrol with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def scan(self):
        interface = self.__get_interface()
        try:
            return interface.Scan(dbus.Dictionary({"Type": "passive"}, 'sv'))
        except dbus.exceptions.DBusException as error:
            raise ServiceError(error) 
Example #24
Source File: mpris_dbus.py    From kawaii-player with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, ui, home, tray, new_tray):
        self.tray = tray
        self.new_tray_widget = new_tray
        bus = dbus.service.BusName(
            AW_MPRIS_BUS_NAME,
            bus=dbus.SessionBus())
        super().__init__(bus, MPRIS_OBJECT_PATH)

        self._properties = dbus.Dictionary({
            'DesktopEntry': 'kawaii-player',
            'Identity': 'kawaii-player', 
            }, signature='sv')

        self._player_properties = dbus.Dictionary({
            'Metadata': dbus.Dictionary({
                'mpris:artUrl': '',
                'xesam:artist': ['None'],
                'xesam:title': 'None',
                'xesam:album': 'None'
            }, signature='sv', variant_level=1), 
            'CanGoNext': True,
            'CanGoPrevious': True,
            'CanPause': True,
            'CanPlay': True,
            'CanControl': True,
            'CanStop': True,
        }, signature='sv', variant_level=2)

        self.ui = ui
        self.home = home 
Example #25
Source File: sound_menu.py    From lplayer with MIT License 5 votes vote down vote up
def signal_paused(self):
        """signal_paused - Tell the Sound Menu that the player has
        been paused. Implementations many need to call this function in order
        to keep the Sound Menu in synch.

        arguments:
            none

        """

        self.__playback_status = "Paused"
        d = dbus.Dictionary({"PlaybackStatus": self.__playback_status},
                            "sv", variant_level=1)
        self.PropertiesChanged("org.mpris.MediaPlayer2.Player", d, []) 
Example #26
Source File: sound_menu.py    From lplayer with MIT License 5 votes vote down vote up
def signal_stoped(self):
        """signal_playing - Tell the Sound Menu that the player has
        started playing. Implementations many need to call this function in
        order to keep the Sound Menu in synch.

        arguments:
            none

        """
        self.__playback_status = "Stopped"
        d = dbus.Dictionary({"PlaybackStatus": self.__playback_status,
                            "Metadata": self.__meta_data}, "sv",
                            variant_level=1)
        self.PropertiesChanged("org.mpris.MediaPlayer2.Player", d, []) 
Example #27
Source File: sound_menu.py    From lplayer with MIT License 5 votes vote down vote up
def signal_playing(self):
        """signal_playing - Tell the Sound Menu that the player has
        started playing. Implementations many need to call this function in
        order to keep the Sound Menu in synch.

        arguments:
            none

        """
        self.__playback_status = "Playing"
        d = dbus.Dictionary({"PlaybackStatus": self.__playback_status,
                            "Metadata": self.__meta_data}, "sv",
                            variant_level=1)
        self.PropertiesChanged("org.mpris.MediaPlayer2.Player", d, []) 
Example #28
Source File: sound_menu.py    From lplayer with MIT License 5 votes vote down vote up
def song_changed(self, artists=None, album=None, title=None,
                     album_art=None):
        """song_changed - sets the info for the current song.

        This method is not typically overriden. It should be called
        by implementations of this class when the player has changed
        songs.

        named arguments:
            artists - a list of strings representing the artists"
            album - a string for the name of the album
            title - a string for the title of the song

        """

        if artists is None:
            artists = ["Artist Unknown"]
        if album is None:
            album = "Album Uknown"
        if title is None:
            title = "Title Uknown"
        if album_art is None:
            album_art = ""

        self.__meta_data = dbus.Dictionary({"xesam:album": album,
                                            "xesam:title": title,
                                            "xesam:artist": artists,
                                            "mpris:artUrl": album_art,
                                            }, "sv", variant_level=1) 
Example #29
Source File: bt-audio.py    From bt-audio with GNU General Public License v3.0 5 votes vote down vote up
def mediaEndpointRegisterAAC(self):
        media = dbus.Interface(self.bus.get_object("org.bluez", self.path), "org.bluez.Media1")
        media_path = '/test/endpoint_aac_' + self.path.split('/')[3]
        self.mediaEndpointAAC = MediaEndpoint(self.bus, media_path)
        properties = dbus.Dictionary({ "UUID" : A2DP_SINK_UUID, "Codec" : AAC_CODEC, "DelayReporting" : True, "Capabilities" : AAC_CAPABILITIES })
        media.RegisterEndpoint(media_path, properties)
        print("MediaEndpoint AAC registered for " + self.path) 
Example #30
Source File: bt-audio.py    From bt-audio with GNU General Public License v3.0 5 votes vote down vote up
def mediaEndpointRegisterSBC(self):
        media = dbus.Interface(self.bus.get_object("org.bluez", self.path), "org.bluez.Media1")
        media_path = '/test/endpoint_sbc_' + self.path.split('/')[3]
        self.mediaEndpointSBC = MediaEndpoint(self.bus, media_path)
        properties = dbus.Dictionary({ "UUID" : A2DP_SINK_UUID, "Codec" : SBC_CODEC, "DelayReporting" : True, "Capabilities" : SBC_CAPABILITIES })
        media.RegisterEndpoint(media_path, properties)
        print("MediaEndpoint SBC registered for " + self.path)