A Spotify player with a Firebase integration. Perfect for an office where everyone can control the player and enqueue tracks. Great together with spotbot-client.
- Start/Stop audio (of course!)
- Add tracks to a queue.
- Set a playlist or an album as the current playlist.
- Plays from the queue first and fallbacks to the playlist/album when the queue is empty.
- Stores state/queue in Firebase.
- Use a client (spotbot-client) to control the player via your browser.
- Last.fm scrobbling.
- Checkout code
git clone https://github.com/himynameisjonas/spotbot.git
- Install Libspotify (see separate section)
- Install node dependencies
npm install
- Provide a Spotify app key as
spotify_appkey.key
(binary) in the project’s root. - Have a Spotify Premium account and a (free) Firebase account and config the player with a .env file:
SPOTIFY_USERNAME=xxx
SPOTIFY_PASSWORD=yyy
SERVER_PORT=3030
FIREBASE_URI=https://xxxx.firebaseio.com
Enable scrobbling to Last.fm by setting the following environment variables.
LASTFM_API_KEY=XXX
LASTFM_API_SECRET=YYY
LASTFM_USERNAME=himynameisjonas
LASTFM_PASSWORD=xxx
Register an app on Last.fm to get the keys for LASTFM_API_KEY
and LASTFM_API_SECRET
.
See node-spotify for more information.
brew install homebrew/binary/libspotify
sudo ln -s /usr/local/opt/libspotify/lib/libspotify.12.1.51.dylib /usr/local/opt/libspotify/lib/libspotify
Firebase nodes and their uses. Plase note that arrays are a bit special in Firebase
- player
- current_track
- uri read/write Uri to the currently playing track. Set uri to immediately change track.
- started_at read-only timestamp when the current track started playing
- playing read/write Boolean showing current status (playing/paused)
- next write Boolean. Set to true to skip to next track in queue/playlist. Will be set to false again as soon the player has changed track.
- current_track
- playlist
- uri read/write URI to the current playlist/album. Set to a new URI/URL to change playlist/album.
- shuffle read/write Boolean to controll shuffle on/off for the current playlist.
- name read-only Name of the current playlist.
- tracks read-only Array of Uri:s of the current playlist’s tracks.
- queue read/write Array of objects with an uri property. Add to enqueue new track, remove to drop a track from the queue.
- volume read/write Volume as a String, 0 to 100
Use spotbot-client for an easy way to controll the player
It uses node-loudness to control the systems output volume. Supports Mac Os and Linux(Alsa)