-
Notifications
You must be signed in to change notification settings - Fork 20
Node spotify on Raspbmc
This is a short tutorial about how to install node-spotify on Raspbmc.
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.
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.
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.
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.
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.
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.