radiopi
Local development
- Go to https://developer.spotify.com/dashboard and create a new app.
- Run the application:
go run main.go "-X main.clientID=${SPOTIFY_CLIENT_ID} -X main.clientSecret=${SPOTIFY_CLIENT_SECRET}" --device-id=<your-device-id> --playlist-run=<your-playlist-id>
Go to http://localhost:3000 and login with your Spotify account.
Build & copy to Raspberry Pi
Build for the Raspberry Pi:
env GOOS=linux GOARCH=arm GOARM=5 go build -o build/radiopi-arm5 -ldflags "-X main.clientID=${SPOTIFY_CLIENT_ID} -X main.clientSecret=${SPOTIFY_CLIENT_SECRET}"
(Optional) If you want you can add a new line to your /etc/hosts
file with the IP of your Pi. For example:
192.168.178.78 radiopi.local
Otherwise, please replace radiopi.local
with the IP of your Pi in the following instructions.
Copy the binary to the Raspberry Pi
scp build/radiopi-arm5 pi@radiopi.local:radiopi
Autoplay on startup
# Copy the service and configure it:
cp radiopi.service-template radiopi.service
# Copy the service to the Pi:
scp radiopi.service pi@radiopi.local:
# On the Pi:
sudo mv radiopi /usr/local/bin/
sudo mv radiopi.service /etc/systemd/system/
sudo chmod 644 /etc/systemd/system/radiopi.service
sudo systemctl enable radiopi.service
sudo reboot