diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml
new file mode 100644
index 0000000..9ab233f
--- /dev/null
+++ b/.idea/jsLibraryMappings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index a712a20..f65e00c 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -55,21 +55,5 @@
-
-
-
-
- 1.6
-
-
-
-
-
-
-
diff --git a/cosmfetcher.js b/cosmfetcher.js
index 6db581e..120357a 100644
--- a/cosmfetcher.js
+++ b/cosmfetcher.js
@@ -1,53 +1,56 @@
-var assert = require('assert'),
- restify = require('restify'),
- osc = require('node-osc');
+// this is a json fetcher for streams from cosm.com
+// to use, simply start "node cosmfetcher.js "
+// configuration
+var streams = [ 91755, 70632, 53146, 45582, 64590 ]; // configure which cosm streams to fetch
+var pollingInterval = 1000; // in ms
+var sendAlways = false; // if set to true, fetcher will always send osc messages
+ // regardless if value changed
+// end configuration
-var hubAddress = '192.168.23.43', hubPort = 7110;
+var restify = require('restify'), osc = require('node-osc');
+var hubAddress = process.argv.length > 2 ? process.argv[2] : '192.168.23.43';
+var hubPort = process.argv.length > 3 ? process.argv[3] : 7110;
+
+console.log("using " + hubAddress + ":" + hubPort + " as hub");
var oscClient = new osc.Client(hubAddress, hubPort);
-
-var streams = [ 91755, 70632, 53146, 45582, 64590 ];
-
-var client = restify.createJsonClient({
- url: 'http://api.cosm.com', headers: {'X-ApiKey':'orKBBdLAKuKJU-RxqmZpZB6q0baSAKxBTVhKdjhUNkdyVT0g'},version:'*'
+var cosmClient = restify.createJsonClient({
+ url: 'http://api.cosm.com',
+ headers: { 'X-ApiKey':'orKBBdLAKuKJU-RxqmZpZB6q0baSAKxBTVhKdjhUNkdyVT0g' },
+ version:'*'
});
var recentvalues = {};
-var getstream = function(streamId) {
- client.get('/v2/feeds/' + streamId + ".json", function(err, req, res, obj) {
-
- if(err == null && obj.datastreams != null) {
- for(var i=0;i
+