using dbus with practice

John (J5) Palmieri johnp at
Wed Feb 2 13:20:00 PST 2005

On Wed, 2005-01-26 at 17:28 +0000, Keir Lawson wrote:
> hello, im new to dbus and am attempting to use it in conjuntion with
> muine to create a "now listening to" area in my blog. Documentation on
> the python interface seems extremly thin on the ground, however by
> adapting the example signal client in CVS i have managed to achieve a
> little. I can get my script to recieve messages from muine, however,
> once i have those messages i havent a clue how to disect them, ie
> retrieve the album name, band name etc.  I assume this is very easy to
> do, and probally just stupidity on my part, but could some one please
> help me? my code is curently looking like this (in the little test i
> wrote):
> #! /usr/bin/python
> #test
> import gtk
> import dbus
> bus = dbus.SessionBus()
> service = bus.get_service("org.gnome.Muine")
> remote_object =
> service.get_object("/org/gnome/Muine/Player","org.gnome.Muine.Player")
> def foobar(interface, signal_name, service, path, message):
> 	print type(message)
> remote_object.connect_to_signal("SongChanged", foobar)
> gtk.main()

def foobar (interface, signal_name, service, path, message):
	args = message.get_args_list()
	#get the arguments in the order they were sent
	album_name = args[0]
	band_name = args[1]

hope that helps.

John (J5) Palmieri
Associate Software Engineer
Desktop Group
Red Hat, Inc.

More information about the dbus mailing list