Rhythmbox control

Submitted by ormiret on Mon, 02/04/2007 - 05:47.

Small python script to provide some rhythmbox control:

#! /usr/bin/env python
import dbus
import sys

try:
    command = sys.argv[1]
except IndexError:
    command = ""

session_bus = dbus.SessionBus()

player = session_bus.get_object('org.gnome.Rhythmbox',
                             '/org/gnome/Rhythmbox/Player')

if command == "next":
    player.next()
elif command == "toggle":
    player.playPause(True)
else:
    print "Usage: %s next|toggle" % sys.argv[0]

I use xbindkeys to call the different functions from key presses.

Update: I have now discovered rhythmbox-client which offers this and more functionality and is maintained by other people if Rythmbox changes its dbus interface.

( categories: )