MPD (Music Player Daemon) - Jump to song

Directly scroll to bottom if you agree with the idea 'talk is cheap, show me the code' :)

When I was using Windows (i don't have a Windows installed on my system now), I used to use Foobar2000 as music player. It's being simple and lightweight was the most important reason of my preference. But another reason was, a plugin called AMIP. It has a great 'jump to song' feature. A key combination (CTRL + J by default) brings up a window that has a input box at the top and list of your all tracks below. As you type in input box, it filters your tracks using your input as filter. And when you press enter that window disappears and the first track matching your filter starts to play. With this feature it's pretty easy to switch to a specific track when you are working on something and don't want to un-minimize another window to search that specific song. Here is a screenshot:

Now on my GNU/Linux box I am using MPD (and Mpc as client). And I wanted the same feature, but there is only one music player that has it. It is Audacious (which is actually a good one), however i didn't want to give up my flawlessly working MPD only for that feature and wrote a shell script to switch to song I want to listen :P

What does it do?

  • it gets all tracks in your current playlist
  • filters with the parameters you entered
  • if one track matches plays it or if multiple tracks match plays first one matching
  • if no track matches, simply does nothing :)

How to use it? Well... I added ~/.local/bin directory to $PATH variable and linked minion.sh file to ~/.local/bin/j and now i am changing song with command (i am running command with gmrun):

$ j all the same sick puppies

And filtering all the parameters I gave it finds track "Sick Puppies - Mastered - All The Same" on my list and plays.

Where is the code?

You can find most up-to-date code in my github. But here is the current version (by 2011 April 19), clicky.