htilly / zenmusic

Slack / Sonos / Spotify / Node.js - Control Sonos through #Slack
125 stars 36 forks source link
bot music nodejs slack sonos spotify

Build Status Known Vulnerabilities

SlackONOS

Slack / Sonos / Spotify / Node.js - Control Sonos through #Slack

Screenshot

ScreenShot

(🔴) config.json MUST be moved to config folder. (🔴)

What is it?

It´s a #slack-bot that control Sonos (and spotify). Highly democratic bot :) Uses https://github.com/bencevans/node-sonos to controll Sonos.

What do I need in order to get it to work?

1: A Sonos player (configured with Spotify).
2: A slack-bot configured in #Slack
3: A server running node.js
4: Know the IP of your Sonos. Preferably a static one.
5: A valid spotify account with Client ID & Client Secret. Head over to: https://developer.spotify.com/dashboard/applications to set it up. Enter the data in the config.json file.

Installation

DOCKER COMPOSE

(you must point to the config.json, example can be found here)

services:
slackonos:
  container_name: slackonos
  image: htilly/slackonos:latest
  restart: unless-stopped
  volumes:
    - /PATH_TO_CONFIG_FILE_FOLDER:/app/config

Firewall settings

Server running the index.js needs to be able to talk to the Sonos on port 1400 (TCP) Sonos needs to be configured and setup with Spotify and have access to internet.

Configuration You must provide the token of your Slack bot and the IP of your Sonos in either config.json (see config.json.example), as arguments or as environment variables. Examples:

node index.js --token "MySlackBotToken" --sonos "192.168.0.1"

or

token="MySlackBotToken" sonos="192.168.0.1" node index.js

You can also provide any of the other variables from config.json.example as arguments or environment variables. The blacklist can be provided as either an array in config.json, or as a comma-separated string when using arguments or environment variables.

Logo for the bot in #Slack can be found at "doc/images/ZenMusic.png

What can it do?

It will queue you requests and play it.. However if X amount of people for any strange reason doesn't like the current track, it will listen to the command "gong" and eventually skip to the next track.

It also future some admin commands like "setvolume", "next", "stop" etc.

List of commands (just type help in the channel)

ADMIN FUNCTIONS

Info

Please use it to get some music in the office / home.

We would appreciate if you drop a comment or send a pm... and please feel free to add / change stuff!! Much appreciated!

Installation

For installation, see the file INSTALL.

Or have a look at the Wiki. https://github.com/htilly/zenmusic/wiki

KnownBugs

* Validate add / unique track doesn´t work. I.e - You can add same track 10 times in a row. * Vote does not move track in queue.

ToDo

DONE