Skip to content
This repository has been archived by the owner on Jun 4, 2023. It is now read-only.

Commit

Permalink
Adding support for manual setup of devices
Browse files Browse the repository at this point in the history
* added argument "--devices"  - takes comma-separated list of IP[:Port]
* changed version to "0.1.1-jona5' and added <me> as a contributer
* added documentation to README.md
  • Loading branch information
iona5 committed May 23, 2015
1 parent 76a557f commit 1f503d1
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
=========

##### 0.1.1-iona5
- Added support for selecting devices without discovery through `--devices <device_list>' to 0.1.1 tree

##### 0.1.1
- Added support for grouped and paired devices

Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <device_list>` 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
-----------
```
Expand Down
17 changes: 16 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -96,7 +97,7 @@ var setupSonos = function(device) {
airplayServer.start();

});
}
};

if (flags.get('version')) {

Expand All @@ -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...');
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"name": "airsonos",
"version": "0.1.1",
"version": "0.1.1-iona5",
"author": "Stephen Wan <[email protected]>",
"description": "AirTunes to Sonos devices",
"contributors": [
{
"name": "Stephen Wan",
"email": "[email protected]"
},
{
"name": "@iona5 (GitHub)"
}
],
"scripts": {
Expand Down

0 comments on commit 1f503d1

Please sign in to comment.