Skip to content

Node spotify on Raspbmc

Moritz Schulze edited this page Nov 24, 2013 · 9 revisions

This is a short tutorial about how to install node-spotify on Raspbmc.

Install nodejs

You can download a binary of nodejs from the nodejs homepage. There is a binary for ARM-based system here. Just download and unzip the tar file and you are ready to go.

Furthermore you can compile nodes on your own, but this will take a while.

Install libspotify

To use Spotify you need the libspotify for the Raspberry Pi. Go to the developer page of Spotify and download the version for the eabi-armv6hf architecture. Just download and unzip the tar and then follow the instructions from the README file.

Download the binary app key

You need an app key to use node-spotify. This appkey can be optained from the developer page as well. Be sure to download the binary version of the appkey.

Install alsa

To get alas working you can use the package manager from raspbmc (debian). Just enter sudo apt-get install alsa-utils. This will install alsa and the alsa-utils. There is a good tutorial on how to install alsa here if you want to have more information.

Download node-spotify

Finally, you can download the binary version of node-spotify for the raspberry pi from node-spotify.com. This zip contains two files. Just copy the two files to the node_modules folder of your nodes installation and you are done.

First test

If everything is in place you can make a first test. Here is some sample code you can enter into the nodejs repl.:

var spotify = require('spotify')({ appkeyFile: 'spotify_appkey.key' });
spotify.ready( function() {
    var starredTracks = spotify.getStarred().getTracks();
    spotify.player.play(starredTracks[0]);
});
spotify.login('user', 'password', false, false);

Here you just have to edit the following entries:

  • spotify_appkey.key
  • user
  • password

and you are ready to go. This will start node-spotify and plays the first song from your Starred playlist.

Clone this wiki locally