Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ List of commands (just type help in the channel)
* Now playing. Announce when starting a new song.
* When asking for "Stat" show most played songs and most active users.
* When local playlist is empty -> fallback and start playing "$playlist", i.e. Spotify topp 100.
* Limit consecutive song additions by non-admin
* Restrict songs already in the queue
* Delete range of songs from queue
* Vote to flush entire queue

*DONE*

Expand Down
3 changes: 2 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"standardChannel" : "music",
"sonos" : "IP_TO_SONOS",
"token" : "SLACK:TOKEN",
"market" : "US"
"market" : "US",
"maxVolume" : 75
}
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var Sonos = require('sonos').Sonos
var configure = require('./config.json');
var sonos = new Sonos(configure.sonos);
var adminChannel = configure.adminChannel;
var maxVolume = configure.maxVolume;
var market = configure.market;
var standardChannel = configure.standardChannel;
var urllibsync = require('urllib-sync');
Expand Down Expand Up @@ -218,7 +219,7 @@ function _setVolume(input, channel) {
} else {
vol = Number(vol);
console.log(vol);
if(vol > 55) {
if(vol > maxVolume) {
slack.sendMessage('You also could have tinnitus _(say: tih-neye-tus)_', channel.id);
} else {
sonos.setVolume(vol, function(err, data) {
Expand Down Expand Up @@ -478,7 +479,7 @@ function _append(input, channel) {
if (state === 'stopped') {
// Ok, lets start again.. NO Flush
//Add the track to playlist...
sonos.addSpotifyQueue(spid, function (err, res) {
sonos.addSpotify(spid, function (err, res) {
var message = '';
if(res) {
var queueLength = res[0].FirstTrackNumberEnqueued;
Expand Down Expand Up @@ -590,7 +591,7 @@ function _add(input, channel) {
if(flushed) {
slack.sendMessage('Clean slate.. Let´s make it better this time!!', channel.id);
//Then add the track to playlist...
sonos.addSpotifyQueue(spid, function (err, res) {
sonos.addSpotify(spid, function (err, res) {
var message = '';
if(res) {
var queueLength = res[0].FirstTrackNumberEnqueued;
Expand All @@ -617,7 +618,7 @@ function _add(input, channel) {
});
} else if (state === 'playing') {
//Add the track to playlist...
sonos.addSpotifyQueue(spid, function (err, res) {
sonos.addSpotify(spid, function (err, res) {
var message = '';
if(res) {
var queueLength = res[0].FirstTrackNumberEnqueued;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"htmlencode": "0.0.4",
"@slack/client": "^3.5.1",
"sonos": "git+https://github.com/bencevans/node-sonos.git#bfb995610c8aa20bda09e370b0f5d31ba0caa6a0",
"sonos": "git+https://github.com/bencevans/node-sonos.git#master",
"urlencode": "^1.1.0",
"urllib-sync": "^1.1.2"
}
Expand Down