Adeptive / SoundTouch-NodeJS

Bose SoundTouch Node JS API
Apache License 2.0
34 stars 22 forks source link

Can't select STORED_MUSIC #9

Open theovassiliou opened 6 years ago

theovassiliou commented 6 years ago

server.js crashes when trying to select a STORED_MUSIC with the following error messages:

SoundTouch-NodeJS/api.js:382
handler(json);
 ^
TypeError: handler is not a function
   at Request._callback (/Users/the/Google Drive Privat/Coding/soundtouch/node-soundtouch/SoundTouch-NodeJS/api.js:382:9)
   at Request.self.callback (/Users/the/Google Drive Privat/Coding/soundtouch/node-soundtouch/SoundTouch-NodeJS/node_modules/request/request.js:186:22)
   at emitTwo (events.js:126:13)
   at Request.emit (events.js:214:7)
   at Request.<anonymous> (/Users/the/Google Drive Privat/Coding/soundtouch/node-soundtouch/SoundTouch-NodeJS/node_modules/request/request.js:1163:10)
   at emitOne (events.js:116:13)
   at Request.emit (events.js:211:7)
   at IncomingMessage.<anonymous> (/Users/the/Google Drive Privat/Coding/soundtouch/node-soundtouch/SoundTouch-NodeJS/node_modules/request/request.js:1085:12)
   at Object.onceWrapper (events.js:313:30)
   at emitNone (events.js:111:20)

What I sent was:

localhost:5006/Office/select/STORED_MUSIC/55076f6e-6b79-1d65-a4eb-00089bea8bd7%2F0/0%241%2417%243338%2421161

I got the information out of:

OW PLAYING UPDATED { nowPlaying: 
{ deviceID: '08DF1F1A065C',
 source: 'STORED_MUSIC',
 sourceAccount: '55076f6e-6b79-1d65-a4eb-00089bea8bd7/0',
 ContentItem: 
  { source: 'STORED_MUSIC',
    location: '0$1$17$3338$21001',
    sourceAccount: '55076f6e-6b79-1d65-a4eb-00089bea8bd7/0',
    isPresetable: 'true',
    itemName: 'Bla bla' }
....

So I urlencoded the sourceAccount valueand the location to the above mentioned REST call. Interestingly I saw by using the sample.js

NOW SELECTION UPDATED { preset: 
{ id: '0',
 ContentItem: 
  { source: 'STORED_MUSIC',
    type: '55076f6e-6b79-1d65-a4eb-00089bea8bd7/0',
    location: 'function %28json%29 {\n        res.json%28json%29;\n    }',
    sourceAccount: '0$1$17$3338$21161',
    isPresetable: 'true',
    itemName: 'Select using API' } } }
NOW PLAYING UPDATED { nowPlaying: 
 { deviceID: '08DF1F1A065C',
 source: 'INVALID_SOURCE',
 ContentItem: { source: 'INVALID_SOURCE', isPresetable: 'true' } } }
Powered On
Not playing

As it looks some source code is passed into the REST call (see location). The sourceAccount while decoded correctly was displayed in type. So I guess something is beeing mixed up.