Play music from Slack: Raspberry Pi + Mopidy + Spotify
This is a bot to control music playback via Slack channel. It communicates commands from users to a Mopidy server via JSON RPC endpoint. Mopidy makes it possible to use Spotify as a media source, but you would need a premium account ($10/mo).
Users in Slack can control playlist: add new tracks, skip, pause, stop and control volume. Musicbot will send notification when next track starts playing or when new tracks are added to the playlist.
Mopidy is a very flexible media streaming solution that works fine on all major systems including Raspberry PI. Even an old RPi model A with 256 Mb RAM should be good enough. Musicbot itself has a very small memory footprint and is distributed as a precompiled binary.
List of all available commands:
help
- Show help usagecurrent
- Get current tracknext|skip
- Skip to the next trackpause
- Pause playbackresume
- Resume playbackstop
- Stop playbackplay
- Play current trackplay query
- Play first 10 tracks that match querytracks|lists
- Get tracks in the playlistclear
- Remote all tracks from playlistvol|volume
- Get current volumevol|volume (up|down|num)
- Change volume
You can download a precompiled binary for your OS from Github Releases
Install the package:
go get github.com/sosedoff/musicbot
Clone repository run setup task:
make setup
Build a binary for current OS:
make build
Build binaries for OSX (amd64), Linux (amd64/arm):
make release
You'll see the output:
Number of parallel builds: 8
--> linux/amd64: github.com/sosedoff/musicbot
--> linux/arm: github.com/sosedoff/musicbot
--> darwin/amd64: github.com/sosedoff/musicbot
All available options and environment variables:
Usage:
musicbot [OPTIONS]
Application Options:
--mopidy= Mopidy server host:port [$MOPIDY_HOST]
--slack-token= Slack integration token [$SLACK_TOKEN]
--slack-channel= Slack channel name (general) [$SLACK_CHANNEL]
-d, --debug Enable debugging mode (false)
-v, --version Print version
Help Options:
-h, --help Show this help message
IMPORTANT
Please make sure you create a BOT slack token, not a regular web hook or a slash command token. Those tokens do not work for RTM (real-time messages) via Slack's websockets.
MIT