I wrote some javascript to delegate messages from XBMC to my Dune mediaplayer. So i am starting on windows with a batch file that executes my javascript with Node.js code in it.
start.bat:
@echo off
node \Users\Flo\Desktop\file.js %1
file.js:
var http = require("http");
var filepath = process.argv[2].substring(6);
filepath = filepath.replace(/\\/g,"/");
var dcmd = "http://dune/cgi-bin/do?cmd=start_file_playback&media_url=storage_name:/" + filepath;
http.get(dcmd, function(res) {
console.log("Got response: " + res.statusCode);
var bodyarr = [];
res.on('data', function(chunk){
bodyarr.push(chunk);
});
res.on('end', function(){
console.log(bodyarr.join('').toString());
});
}).on('error', function(e) {
console.log("Got error: " + e.message);
});
Everthing works fine with this setup. But now i want to do this on a Raspbian system with a shell script.
start.sh:
#!/bin/sh
nodejs /usr/local/bin/file.js $1
And i am always getting the error: connect ECONNREFUSED Why?
Thanks for any help!