The simple solution to use a Spotify account to play music on the Raspberry Pi is Despotify. But the client is too minimalist for me. You can not control it with other tools or use it with other interface.
MPD, on the other hand is know to be a powerful application.
MPD is " a flexible, powerful, server-side application for playing music. Through plugins and libraries it can play a variety of sound files while being controlled by its network protocol."
MPD is not http://mpd.wikia.com/wiki/What_MPD_Is_and_Is_Not.
One year ago @simonkagstrom start working on a plugin for MPD : Spotify support via despotify http://thread.gmane.org/gmane.comp.audio.musicpd.devel/1928
I use it everyday (if the soundcard doesn't crash) to play my Spotify playlist on my Pi, and I can control my Raspotify Box with my Android device via MPDroid https://play.google.com/store/apps/details?id=com.namelessdev.mpdroid&hl=fr
Because the Despotify version hack by Simon Kagstrom is not maintain, my solution is not very clean.
Step 1 : Install the not working Despotify version of @simonkagstrom on your Pi
(You need to be root / sudo.)
- Install these packages
- Code: Select all
pacman -Sy libtool git openssl mpg123 libvorbis ncurses libao git base-devel
- Download the code
- Code: Select all
git clone git://github.com/SimonKagstrom/despotify.git
- Build the code
- Code: Select all
cd despotify/src && make && make install && sudo make install
Step 2 : Install MPD
- Download the code
- Code: Select all
git clone git://git.musicpd.org/master/mpd.git
- Options
- Code: Select all
cd mpd && ./autogen.sh --enable-despotify
If everything is good, at the end you will have something like that :
- Code: Select all
########### MPD CONFIGURATION ############
Archive support:
(-bzip2) (-ISO9660) (-ZIP)
Client support:
(+IPv6) (+TCP) (+UNIX Domain Sockets)
File format support:
(+AAC) (-C64 SID) (+FFMPEG) (+FLAC) (-FluidSynth) (-GME) (+libsndfile)
(-MikMod) (-MODPLUG) (+MAD) (+MPG123) (+MP4) (-Musepack)
(-OggTremor) (+OggVorbis) (-WAVE) (-WavPack) (-WildMidi)
Other features:
(+libsamplerate) (+inotify) (+SQLite)
Metadata support:
(+ID3)
Playback support:
(+ALSA) (-FFADO) (+FIFO) (+File Recorder) (+HTTP Daemon) (+JACK)
(+libao) (-Media MVP) (+OSS) (-OpenAL) (-OS X) (-Pipeline)
(+PulseAudio) (-ROAR) (-SHOUTcast) (-Solaris) (-WinMM)
Streaming encoder support:
(+FLAC) (+LAME) (+Ogg Vorbis) (-TwoLAME) (+WAVE)
Streaming support:
(+CDIO_PARANOIA) (+CURL) (+Despotify) (-Last.FM) (+Soundcloud)
(+MMS) (-SOUP)
Be sure to have +ALSA & +Despotify.
- Build the code
- Code: Select all
make && sudo make install
Step 3 : Uninstall Despotify
- Uninstall
- Code: Select all
cd despotify/src && sudo make uninstall
Step 4 : Install the working version of Despotify
- Install this package
- Code: Select all
pacman -Sy svn
- Download the code
- Code: Select all
svn co https://despotify.svn.sourceforge.net/svnroot/despotify/src despotify
- Build the code
- Code: Select all
cd despotify && make && sudo make install
Step 5 : Configuration of MPD
The file to edit is /etc/mpd.conf . " You should have a copy of an example config in one of two places on your computer: /usr/doc/mpd.conf.example or /usr/local/doc/mpd.conf.example" http://mpd.wikia.com/wiki/Music_Player_Daemon_Example_Config
To simplify, you can use mine, but you will need to create some file and dir :
- Code: Select all
mkdir -p ~/.mpd/playlists
- Code: Select all
touch ~/.mpd/{mpd.db,mpd.log,mpd.pid,mpdstate}
My mpd.conf : http://pastebin.com/PNaxGYJb
4 things need to be change from my mpd.conf : music_directory (dir with your mp3s), user (name of the user), despotify_user (Spotify user) & despotify_password (Spotify password) .
Save the file at /etc/mpd.conf
Step 6 : Start MPD
- Code: Select all
sudo mpd /etc/mpd.conf &
Step 7 : Client
I use ncmpcpp, but they are many : http://mpd.wikia.com/wiki/Clients
MPC is a simple MPD client via command line.
- Code: Select all
pacman -Sy mpc ncmpcpp
- Start your MPD client

Step 8 : Add a song / a playlist from Spotify to the MPD playlist
- Code: Select all
mpc load spt://[SPOTIFY URI]
The spotify URI can be found with the desktop client.
For example :
- Code: Select all
mpc load spt://spotify:track:1li0jGGRIaMaNNRBV8JXZ4

Step 9 :
Enjoy
If you have any question, please ask on the forum or @SheepOnMeth. I will do my best to help you.