Januar 11, 2009 Archives

So 11. Jan 13:13:05 CET 2009

Short overview about mpris and command line tools

mpris player

media mlayer remote interface specification, short mpris is a specification to connect media players via dbus. This is quite useful as you can have one command for example to control Amarok, Audacious or any other mpris capable player.
This are all gui player, so lets have a look at mpd, a music daemon simple to control via commandline.
mpd natively does not support dbus, but there is another solution, mpDris, a mpd client exporting the mpris functionality via dbus.

mpris client

A really nice and powerful mpris command-line client is mpris-remote to access an mpris capable player. Here are some examples commands:
mris-remote pause # toggle pause 
mris-remote next # next 
mpris-remote random true 
mpris-remote random false 
it is really intuitiv, so just use ist.

So what is the benefit?

  • You only have one command to control them all, so you can just switch your music player and your scripts will work. So instead of binding player specific commands to, e.g. your multimedia keys on the keyboard, consider using mpris and it does not depend if you use mpd, amarok, audacious or any other client.
  • Additional features are possible, for example inhibit power-manager when playing music, so you can close the lid, unhibit when music stop so your pc can start sleep. And this works for multiple player out of the box.
  • You can can subscribe to signals from the music player, so you can just get the information and don't have to check the status regular
So, if you going to control a music player via commandline, look if the player support mpris and use this, instead of proprietary command line.

Posted by Ulrich Dangel | Permanent Link | Categories: Stuff