August 2, 2014

Dbus-MPRIS Music Player Controller

The Short story :
Here is a shell script that can control media players like Amarok, Clementine, mpd & VLC :

The long story :
Like most of the programmers, I'm a big fan of command line. Since I can touch type, things get done really faster. There will be a music player running in my system and most of the time I will be using mpd with ncmpcpp. Only problem is that I keep forget which key is used to stop/pause ncmpcpp. This problem was quickly resolved by installing mpc and few aliases. Things were pretty fine and I even wrote a script ( to extract the album art of the song being played in mpd and show it on Conky .

Problems cropped up when Amarok or Clementine were used. The controls were on top for Amarok and in case of Clementine it was just opposite. I could use the media keys in the keyboard, but I hardly use them as mpd does not respond to them. The search of consistency ended with MPRIS. Quickly put together a script and any of these media players could be controlled with a single script. Few aliases and I can control the media player without leaving vim :)

For VLC and mpd, MPRIS need to be enabled manually. The VLC player need to be started as vlc --control dbus. In case of mpd, mpDris2 need to be running.

No comments:

Post a Comment