const { DeviceDiscovery } = require('sonos'); DeviceDiscovery((device) => { //console.log('found device at ' + device.host + " - " + device.friendlyName) device.deviceDescription().then(descr => { // look for a sonos named "Sonos Roam" if (descr.friendlyName.match(/Sonos Roam/)) { console.log(descr); // Coheed - Vaxis II - first track // https://play.napster.com/track/tra.676707759?ocode=social_user&pcode=social_user&cpath=Link&rsrc=track // // I learned the song uri by playing a song and then calling currentTrack() to find the uri // Then I tried to modify this uri to play a known song. // The 'atra.' seems to be the track name. I'm not entirely sure what the remaining |v1|ALBUM|... bits are // For good measure, the 'alb..mp4' I inserted the album ID for the album this track is on device.play("x-sonos-http:ondemand_track%3a%3atra.676707759|v1|ALBUM|alb.676707757.mp4?sid=202&flags=8232&sn=1"); } }); });