diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2011-10-05 23:02:16 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2011-10-06 11:13:33 +0300 |
commit | 6e215f1f86788b54482515c43378c03f207785ef (patch) | |
tree | 7b9832e5a46b7f732490da253050e38775a1c9d5 /test/simple-player | |
parent | 14ae307458e0bf1a3014bc799919244318d09293 (diff) |
Add simple-player test script
Diffstat (limited to 'test/simple-player')
-rwxr-xr-x | test/simple-player | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/test/simple-player b/test/simple-player new file mode 100755 index 000000000..f483897b8 --- /dev/null +++ b/test/simple-player @@ -0,0 +1,56 @@ +#!/usr/bin/python + +import sys +import dbus +import dbus.service +import dbus.mainloop.glib +import gobject + +class Player(dbus.service.Object): + @dbus.service.method("org.bluez.MediaPlayer", + in_signature="sv", out_signature="") + def SetProperty(self, key, value): + print "SetProperty (%s, %s)" % (key, value) + return + +if __name__ == '__main__': + dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) + + bus = dbus.SystemBus() + manager = dbus.Interface(bus.get_object("org.bluez", "/"), + "org.bluez.Manager") + + if len(sys.argv) > 1: + path = manager.FindAdapter(sys.argv[1]) + else: + path = manager.DefaultAdapter() + + media = dbus.Interface(bus.get_object("org.bluez", path), + "org.bluez.Media") + + path = "/test/player" + player = Player(bus, path) + mainloop = gobject.MainLoop() + + properties = dbus.Dictionary({ "Equalizer" : "off", + "Repeat" : "off", + "Shuffle" : "off", + "Scan" : "off", + "Status" : "playing", + "Position" : dbus.UInt32(0) }) + + print properties + + metadata = dbus.Dictionary({ "Title" : "Title", + "Artist" : "Artist", + "Album" : "Album", + "Genre" : "Genre", + "NumberOfTracks" : dbus.UInt32(10), + "Number" : dbus.UInt32(1), + "Duration" : dbus.UInt32(10000) }) + + print metadata + + media.RegisterPlayer(path, properties, metadata) + + mainloop.run() |