Hatkirby on November 21st, 2008 at 12:55:33pmThis post is the sixth and final day of VisitorGrid Week. For more information, read the post linked to right there.
This week seems to have gone pretty well. I'm going to end it off with a yummy tutorial. This time it's about MPD, the Music Player Daemon. MPD is a program you can use to play music from your computer without any interface, which is why it is usable even on the command line. MPD usually interacts with a client, which range from MPC, a command line client to GMPC, a GNOME-based graphical client. There are quite a few clients, however, that allow you to interact with MPD wirelessly, via some type of remote control.
I browsed through these and found none that I could to immediately without running out to the store and buying some type of accessory. But, then I found mousempc, a bare-bones client controlled by a mouse. That's right, that includes wireless mice. And, I just happen to have a wireless mouse lying about.
First, I'll tell you how to install MPD, then I'll tell you how to setup mousempc. MPD is easily installed, due to the amount of distributations it's been ported and packaged to, but mousempc is quite a challenge.
Ok, installing MPD. MPD can be found in most Linux distribution's packaging system under the name "mpd". So, for instance, on Debian/Ubuntu, you'd run this command to install MPD:
sudo apt-get install mpd
That wasn't too difficult, was it? The only other thing you really have to do is to import your music into MPD's library.
On Debian, this library resides at
/var/lib/mpd/music/
by default. You can find the location of your library in your/etc/mpd.conf
MPD configuration file under the name "music_directory". Copy your songs into that folder. Note that you may need root privileges to access that folder, so addsudo
to the front of eachcp
command you run.After copying in your files, you need to have MPD re-create it's database. You can do this by running the commands:
sudo mpd --create-db sudo /etc/init.d/mpd restart
The first command re-creates the database and the second restarts MPD. Note that the second command may be different depending on your distribution.
Well, there you have it. Your music files are safe and snug in MPD's database. Now you need to install mousempc. This, as I said before, is the difficult part.
- Begin by downloading the Makefile and mousempc.c from its Subversion repository.
- You need GCC (the GNU C Compiler) to compile mousempc, but it's normally pre-installed on most Linux systems. In case it isn't, however, try installing it with your packaging system using the package name "gcc"
- You also require Make to parse the Makefile. Same post-text as above applies.
- Finally, you require a small package called runit.
- Run the following commands:
make mkdir ~/mousempc cp mousempc ~/mousempc/ cd ~/mousempc mkdir env log cat > run << EOF <\$EVENTFILE exec chpst -u mousempc -e ./env ./mousempc EOF chmod a+x run > env/MPD_HOST > env/MPD_PORT OLD_UMASK=$(umask) umask 077 > env/MPD_PASSWORD umask $OLD_UMASK cat > repeat << EOF ./run ./repeat EOF chmod a+x repeat
- The last thing you need to do is find out which event device your mouse is. Enter this line into the top of the run file created in the previous step:
EVENTFILE=/dev/input/event2
Then, run run:
sudo ./run
Try right clicking with your wireless mouse. If nothing happens, try
/dev/input/event3
in run. If that fails as well,/dev/input/event4
and so on. 7. When you find the correct device, all you need to do to start mousempc is run repeat:sudo ./repeat
There are two problems you can have with this. One is that, after running repeat, you get some error about not having enough permissions to do whatever. This is resolved by looking in the
/etc/mpd.conf
file mentioned earlier, finding the value entitled "password", and placing that into the MPD_PASSWORD file inside of the env folder.The other problem you can have is that after a while, mousempc stops working. This may be due to the fact that your wireless mouse reciever may have changed event devices. If this happens, simply retry going through
/dev/input/event2
and so on.Finally, that long tutorial is over! Well, I hope you've enjoyed this tutorial, and I hope you've enjoyed VisitorGrid week!
NOV
21
Comments