Date Tags mpd / linux

I really wasn't planning to do a post about this, one of those classic "Seriously, how hard can it be?"..

Quite some time later I found that it wasn't really difficult, just wasn't obvious to be where I looked.

First and foremost, I've refound Music Player Daemon which really is what it says on the tin, a daemon for playing music ;-)

Since most of the music I listen to is in mp3 or flac, it's a fairly obvious choice for me to use something like this to play my music. Having recently gotten Ubuntu back on my workstation, after way too long with running windows, I'm slowly getting more and more good stuff to work again. And of course, the ability to listen to what I find to be good music, goes a long way.

First of all, there's getting mpd and ncmpcpp install, turned out to be fairly easy.

$ sudo aptitude install mpd ncmpcpp  

Then all I had to do was rsync all the music! into /var/lib/mpd/music/, press u in ncmpcpp and it'd update its database.

Found a lot of files were missing, many hours later I've found the reason for that, non UTF-8 compliant filenames, and missing read rights for the 'mpd:audio' user:group it's running as, easily fixed.

$ sudo find /var/lib/mpd/music -type f -exec chmod ugo+r {} \;  
$ sudo find /var/lib/mpd/music -type d -exec chmod ugo+rX {} \;  

Actually, the capital 'x' makes it only set execute bit if it's a directory, so I could really just combine it into one line and run through all the files. I just didn't do that :-)

That was the easy and fast part, now I got music .. almost, just a few changes to /etc/mpd.conf I wanted to put in.

Line numbers are aproximate..

83 bind_to_address "any"  
127 auto_update "yes"  
132 auto_update_depth "4"  
142 follow_outside_symlinks "yes"  
147 follow_inside_symlinks "yes"  
157 zeroconf_enabled "yes"  
162 zeroconf_name "Music Player"  
184 input {  
185     plugin "curl"  
189 }  
204 audio_output {  
205     type "httpd"  
206     name "My HTTP Stream"  
207     encoder "lame" # optional, vorbis or lame  
208     port "8000"  
209     bind_to_address "0.0.0.0" # optional, IPv4 or IPv6  
210     #quality "5.0" # do not define if bitrate is defined  
211     bitrate "192" # do not define if quality is defined  
212     format "44100:16:1"  
213     max_clients "0" # optional 0=no limit  
214 }  
218     audio_output {  
219     type "pulse"  
220     name "My Pulse Output"  
223 }  
225 audio_output {  
226     type "fifo"  
227     name "FIFO Audio"  
228     path "/tmp/mpd.fifo"  
229     format "44100:16:2"  
230 }  
379 replaygain "album"  
404 volume_normalization "yes"  

A few comments:

http output is so I can stream from tablet/phone.. even works through vpn, which is kind of sweet, just a shame my workstation is normally turned off when I'm away and on tablet/phone :-)

Pulse output is the one that plays through my speakers.

Fido output is what lets ncmpcpp display a cute ascii graph of the output on 9

Now, to make last.fm work. Quite some time ago, I installed mpdscribble, that doesn't work any more. Instead, I had to.

$ sudo aptitude install lastfmsubmitd  

I had a few seconds of Yay! till I realized that it didn't submit anything, I also needed.

$ sudo aptitude install lastmp  

And they pretty much ask me for what info they need while installing, lastfmsubmitd needs to get my username and password, lastmp needs to be told where it can find mpd, and that's it. I'm now happily submitting my music listenings to last.fm once again, and can to my delight watch two new logfiles on my workstation to see what goes on.

$ sudo tail /var/log/lastfm/lastmp.log  
2013-12-27 00:47:57,550 lastmp[21781] INFO: New song: Capercaillie - Oran Sugraidh [3:57]  
2013-12-27 00:49:52,676 lastmp[21781] INFO: Sent to daemon  

And see it's buddy over in the other file.

2013-12-27 00:49:58,587 lastfmsubmitd[24010] INFO: Submitting: Capercaillie - Oran Sugraidh [3:57]  
2013-12-27 00:49:58,650 lastfmsubmitd[24010] INFO: Submission(s) accepted  

And that's it.


Comments

comments powered by Disqus