How to use the sonos.SpotifyRegion function in sonos

To help you get started, we’ve selected a few sonos examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github htilly / zenmusic / index.js View on Github external
/* Initialize Logger */
const logger = winston.createLogger({
    level: logLevel,
    format: winston.format.json(),
    transports: [
        new winston.transports.Console({format: winston.format.combine(winston.format.colorize(), winston.format.simple())})
    ]
});

/* Initialize Sonos */
const SONOS = require('sonos')
const Sonos = SONOS.Sonos
const sonos = new Sonos(config.get('sonos'))

if (market !== 'US') {
  sonos.setSpotifyRegion(SONOS.SpotifyRegion.EU)
  logger.info('Setting Spotify region to EU...')
  logger.info("Market is: " + market)
}

/* Initialize Spotify instance */
const spotify = Spotify({clientId: clientId, clientSecret: clientSecret, market: market, logger: logger})

let gongCounter = 0
let gongScore = {}
const gongLimitPerUser = 1
const gongMessage = [
  'Is it really all that bad?',
  'Is it that distracting?',
  'How much is this worth to you?',
  'I agree. Who added this song anyway?',
  "Thanks! I didn't want to play this song in the first place...",