diff --git a/CHANGELOG.md b/CHANGELOG.md index e24aa13..da912ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ Changelog ========= +##### 0.1.1-iona5 +- Added support for selecting devices without discovery through `--devices ' to 0.1.1 tree + ##### 0.1.1 - Added support for grouped and paired devices diff --git a/README.md b/README.md index 92c14b6..8cfc70f 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,30 @@ Searching for Sonos devices on network... Setting up AirSonos for Playroom {172.17.105.103:1400} ``` +Overriding autodiscovery (iona5) +------------- +Sometimes autodiscovery fails. So i added a `--devices ` option to the command line. Here you can +set airsonos to setup only the Sonos devices specified as argument. A Sonos device is +specified with its IP. Optionally you can set also its TCP port if the device is set +to use not the default port (1400). + +This is the syntax: +``` +airsonos --devices SONOS1_IP[:SONOS1_PORT][,SONOS2_IP[:SONOS2_PORT][,...]] +``` + +For example if you have one Sonos device with the IP 192.168.0.100 you would specify +``` +airsonos --devices 192.168.0.100 +``` + +If you have another Sonos at 192.168.0.101 configured with the non-default port 1500, you +can create an airsonos server for both devices with +``` +airsonos --devices 192.168.0.100,192.168.0.101:1500 +``` + + Development ----------- ``` diff --git a/lib/main.js b/lib/main.js index aa0bf4d..3973ecb 100644 --- a/lib/main.js +++ b/lib/main.js @@ -11,6 +11,7 @@ flags.defineBoolean('diagnostics', false, 'run diagnostics utility'); flags.defineBoolean('version', false, 'return version number'); flags.defineInteger('timeout', 5, 'disconnect timeout (in seconds)'); flags.defineBoolean('verbose', false, 'show verbose output'); +flags.defineStringList('devices', [], 'a comma separated list of IP[:port] values where Sonos devices can be found, disables discovery'); flags.parse(); var setupSonos = function(device) { @@ -96,7 +97,7 @@ var setupSonos = function(device) { airplayServer.start(); }); -} +}; if (flags.get('version')) { @@ -108,6 +109,20 @@ if (flags.get('version')) { var diag = require('./diagnostics'); diag(); +} else if (flags.get('devices').length > 0) { + var useDevices = flags.get('devices'); + for (var i = 0; i < useDevices.length; i++) { + var ipPortSplit = useDevices[i].split(':'); + var sonosDevice; + if (ipPortSplit.length > 1) { + sonosDevice = new sonos.Sonos(ipPortSplit[0], ipPortSplit[1]); + } else { + sonosDevice = new sonos.Sonos(useDevices[i]); + } + + setupSonos(sonosDevice, 'Sonos' + i); + } + } else { console.log('Searching for Sonos devices on network...'); diff --git a/package.json b/package.json index ee54fed..23e190a 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,15 @@ { "name": "airsonos", - "version": "0.1.1", + "version": "0.1.1-iona5", "author": "Stephen Wan ", "description": "AirTunes to Sonos devices", "contributors": [ { "name": "Stephen Wan", "email": "stephen@stephenwan.net" + }, + { + "name": "@iona5 (GitHub)" } ], "scripts": {