Presentation of the problem
I'm using several media player on my desktop :
I'm also using several ways to control them :
- xmms-xfce applet
- keyboard extended keys with lineakd
- remote control with an home made receptor
The main drawback of these programs is that they are tightly coupled. xmms-xfce is specificaly designed for xmms, lineakd is configured to be used with xmms and so on ...
The goal of this project is to be able to use any controller with any media player
Solution
According to the website, "DBus is a message bus system, a simple way to application to talk to another one.". It allow loosely coupled communication between applications, exactly what I was looking for :-)
Each media player expose a remote.control interface to dbus with 5 methods :
- play
- pause
- next
- prev
- stop
Then controller just made method call thru dbus to the remote.control interface.
Here is the whole thing as a picture :
Installation of dbus
- Download dbus
- Extract the archive
tar zxvf dbus-0.20.tar.gz
- Compile :
cd dbus-0.20
./configure
make
su -c "make install"
- launch dbus :
eval `dbus-launch --sh-syntax --exit-with-session`
You are now ready to run dbus aware software. (do it in the same term as dbus-launch define a variable with the dbus deamon address)
Note : Fedora Core 1 include a old version of dbus, don't know if it does work...
Downloads dbus add-ons
Here is the implementation of remote.control for the software i'm using :
- beep-media-player. This plugin allow you the control it thru DBus
- mplayer. not done yet as i'm having trouble using dlib native API :-(
- ogle. not done yet.
- xawtv. no tv card so not very usefull to me
- xfce-dbus. Ripped off from xmms-xfce except that it send dbus message
- shell script. To be used with anything that can spawn and run a shell script as an even answer (xchat, linekad, ... )
If you wrote some code for a controller or a media player, feel free to contact me, i'll be adding your piece of code to the list.