Elric's random thoughts in idle times

"Why stop now, when I'm just starting to hate it?" – Marvin the robot

Mpd on Debian with Vim

with one comment

Yes, I know Vim is much more than a music player, or that it surpasses by large any use I may give to it. I just love to use it for almost anything. And as a non-programmer, that anything means whatever but code editing. It’s still pretty enjoyable :)

Being the music lover I am, and the fact that I like to try any music app there is around, it was just a matter a time that I ended up using ANY interface to control my mpd local server. In search for a light one, what the fuck? Vim.


I know there are tons of tips and forums concerning the installation of mpd, and how to fix any of the issues you may find with pulseaudio. However, not all work for me, and therefore I’ll briefly summarize what got me going.

It starts with ….. aptitude install mpd mpc. Big surprise here :)

Next,  you need to add mpd to the pulse* lines you’ll find in the file /etc/group. On a clean install, mpd runs as a root daemon  (that quickly loses privileges in favor of the actual user) at boot so nothing to touch there but the file /etc/mpd.conf. You may start it as user as well, yet that hasn’t worked fine for me in some installations. You also need to set your music directory and other non-complex options there. Don’t forget to add

port “6600”

next to the section where you configure the aforementioned options.

As for the output, also set in mpd.conf, it only worked fine when I left just these two lines to make it go through pulseaudio.

audio_output {
type    “pulse”
name    “My MPD PulseAudio Output”
}

and nothing else worked, not even with the other lines you may find in similar tutorials (and that used to work for me on Ubuntu).
Still, sometimes mpd will take over the soundcard, as it is spawned prior to pulseaudio. If you find this issues, add

pulseaudio-native: LOCAL

in /etc/hosts.allow.
This done, “mpd –create-db” should create the database, and “mpc listall” would show all songs available in the music library. You can run “mpc listall | mpc add” to load the whole library into the playlist, and “mpc play” to start playing the first song in the list.

Ok, now that you have mpd running, you may download any mpd client like Ario, gmpc, pympd or any other of the zillion mpd clients that exist. In this case, we’re setting up Vim.

On almost any distribution, Vim comes with the whole installation pack, so it should be there. Next, go to

http://github.com/gaving/vimmpc/tree/master

or if you have git installed.

git clone git://github.com/gaving/vimmpc.git

which will download the vimmpc plugin for Vim. In order to run it, you need to install the python-mpd and python-zsi packages (Debian’s archive names).

[Edit: The delevoper changed some lines in the plugin to make it work with newer python packages. It’s still usable, but may present some bugs. Please, if you know python, check it up as the developer is up for giving maintenance. The old version has just been uploaded to http://www.vim.org. Download it

You need python-mpdclient and python-zsi to make it work.]

Now, all you have to do is to follow the instructions you may find in the README file (it might be outdated). After running the last step required, you should find something like this.

Screenshot-Songbird

Whoa, no, definitely not this…  but this:

Screenshot-Database

SOBER, that’s the word. But it still has what you expect from a music player, and finding and playing songs is as easy as with… rhythmbox. Ok, not THAT easy, but definitely easier than itunes. No joke intended.

If Vim starts spitting out incomprehensible errors, you may sum them up with “mpc connection refused by pulseaudio”, or something along the lines. Just run “mpc play” from the terminal and that will give you the REAL problem you’re facing. Sometimes, mpd –kill && mpd works. Again, there are countless tutorials in the web to help you out.

After the initial installation, all you need to do is to open a Vim instance, then run “:MPC” at Vim’s command line. Use “:map” for the options. And remember, you can control more advanced mpd/mpc’s options from within Vim just placing a ! symbol before the desired command (i.e. !mpc listall | mpc add, and refresh the screen).

Enjoy!

Advertisements

Written by elric80

September 1, 2009 at 8:33 pm

Posted in debian, linux, music, vim

Tagged with , , , , ,

One Response

Subscribe to comments with RSS.

  1. This is precisely what i’ve been looking for!!
    thank you so much!!! VIM forever! :)

    Tomasz

    November 20, 2009 at 11:28 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: