Controlling Banshee over D-Bus
I needed to be able to control Banshee from another application, and it turns out it has a lovely D-Bus API.
Skip to the next song*:
import dbus
bus = dbus.SessionBus()
banshee = bus.get_object("org.bansheeproject.Banshee",
"/org/bansheeproject/Banshee/PlaybackController")
banshee.Next(False) # use banshee.Previous(False) to skip back one song
Start Banshee playing (this works even if Banshee isn’t running; D-Bus starts it up!):
import dbus
bus = dbus.SessionBus()
banshee = bus.get_object("org.bansheeproject.Banshee",
"/org/bansheeproject/Banshee/PlayerEngine") # note PlayerEngine, not PlaybackController
banshee.Play() # use banshee.Pause() to pause playback
I found these commands using D-Feet*, J5’s D-Bus browser thing, which is great. The program I’m using to call this stuff is open source Enso from the Humanized team, which is also pretty darn useful.
Thanks for the hint on enso. I didn’t know they released the source under a BSD license. Very cool, I remember seeing it a while ago and thinking that it would be really cool if it was open as people would extend it with all kinds of useful features. I can see that you’re already doing exactly that :)
90 minutes later
D-Feet. Nyom. Thanks for that.
8 hours later
Sweet! I’m also discovering the wonders of dbus. Pretty amazing stuff.
9 hours later
[...] = dbus.SessionBus banshee = bus.get_object"org.bansheeproject.Banshee", "/org/bansheephttp://www.kryogenix.org/days/2008/07/02/controlling-banshee-over-d-busA&E Calendar The Fremont ArgusMUSIC FREMONTThe Central Park summer concert series, presented by The [...]
23 hours later