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

adding support for manual setup of Sonos devices #88

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

iona5
Copy link

@iona5 iona5 commented Jan 10, 2015

I am fairly new to node.js. This is in fact my first step into this language. So if i have missed some conventions or you have suggestions how i could make this better, just tell me, highly appreciated.

This adds the argument '--devices' to airsonos. The argument takes a comma separated list of IP addresses. airsonos tries to setup these without doing a discovery via M-SEARCH.

Usage:

node airsonos/ --devices <comma-separated list of IP[:Port]>

Example:

node airsonos/ --devices 192.168.0.100,192.168.0.101:1401

tries to setup airsonos with Sonos devices at IPs 192.168.0.100 and 192.168.0.101. While it connects to .100 over the standard port (1400), it connects to .101 over port 1401.

if a timeout occurs to one or more devices, airsonos prints an error message, but maintains connection to other devices.

// are entered.
var setupDomain = require('domain').create();
setupDomain.on('error', function(err) {
console.error('error on setting up device "'+deviceArg+'": '+err);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iona5 - mind using spaces between concat'd things here for consistency's sake?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also - capital "Error" here? Keeps it stylistically same as above messages.

@stephen
Copy link
Owner

stephen commented Jan 11, 2015

@iona5 - thanks for putting this together! looks mostly good to me, with minor comments above.

Last nitpick - can you reformat using 2 spaces per indent? Keeps it inline stylistically with what it used to look like.

} else if (flags.get('devices').length > 0) {

var deviceArguments = flags.get('devices');
for(var i = 0; i < deviceArguments.length ; i++) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also spacing, here:

for (var i = 0; i < deviceArguments.length; i++)

(perhaps I should add a travis-ci linter..)

@iona5
Copy link
Author

iona5 commented Jan 12, 2015

hi stephen,

thank you. i will update my changes accordingly.

regarding the error handling: i know what you mean, but i guess i will keep that in a separate commit: i am fairly new to node.js and i am not really sure how errors should be handled in your package. i will make a proposal and you say if you like it or not. ;)

cheers
iona5

@stephen
Copy link
Owner

stephen commented Jan 12, 2015

(Feel free to also add yourself as a contributor in package.json 😄)

iona5 added a commit to iona5/airsonos that referenced this pull request Jan 17, 2015
* fixed indents to two spaces
* changed formatting of string concatination
* slight change of error messages
@iona5
Copy link
Author

iona5 commented Jan 17, 2015

i tried to address all the issues.

regarding the error handling i created pull request #91 which includes this pull request.

@iona5 iona5 force-pushed the manual-devices branch 2 times, most recently from fbf36d7 to b08132c Compare May 23, 2015 13:41
iona5 added 2 commits May 23, 2015 15:43
* 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
…e throws error

* individual setups should run in a domain, so we can catch errors individually
* add feature to README.md
@iona5 iona5 force-pushed the manual-devices branch from b08132c to 606f72f Compare May 23, 2015 13:44
@webflo
Copy link

webflo commented Jun 19, 2015

@iona5 @stephen What it necessary to get it done?

@dsully
Copy link

dsully commented Sep 5, 2015

+1 - would like to see this fixed.

@lsmith77
Copy link

at the very least a rebase seems to be required

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants