Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-red-contrib-sonospollytts

Package Overview
Dependencies
Maintainers
1
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-red-contrib-sonospollytts - npm Package Compare versions

Comparing version 1.1.16 to 1.1.20

img/Readme.png

9

CHANGELOG.md

@@ -7,4 +7,11 @@ ![Sample Node](img/logo.png)

<p>
<b>Version 1.1.20</b> March 2020 - In the middle of Coronavirus emergency in Italy<br/>
- CAUTION: You may need to re-enter the AWS credentials.<br/>
- NEW: now the webserver config is in the config-node, so you can have multiple sonospollytts nodes without problem with duplicated webserver ports.<br/>
- FIX: Ownfile, fixed a problem in refreshing the file list upon upload of new files.<br/>
- FIX: SonosPollyTTS, fixed a problem in refreshing the hailing list upon upload of new hailing files.<br/>
- Update help accordingly.<br/>
</p>
<p>
<b>Version 1.1.16</b> March 2020 - In the middle of Coronavirus emergency in Italy<br/>

@@ -11,0 +18,0 @@ - NEW: Automatic discovery added. No more IP addresses to remember.<br/>

6

package.json
{
"name": "node-red-contrib-sonospollytts",
"version": "1.1.16",
"version": "1.1.20",
"description": "Node-Red TTS with Sonos and Amazon Polly or with your own local mp3 announcement files. This node is specific for security alarm announcement, zone announcement, doorbell, weather annoucement etc.",

@@ -26,2 +26,3 @@ "main": "index.js",

"sonospollytts": "sonospollytts/sonospollytts.js",
"sonospollytts-config": "sonospollytts/sonospollytts-config.js",
"ownfile": "sonospollytts/ownfile.js"

@@ -44,3 +45,4 @@ }

"util": ">=0.10.1",
"formidable": "1.2.2"
"formidable": "1.2.2",
"os": ">=0.1.1"
},

@@ -47,0 +49,0 @@ "devDependencies": {

@@ -13,3 +13,3 @@ # Node-Red SonosPollyTTS

<img src='https://github.com/Supergiovane/node-red-contrib-sonospollytts/raw/master/README.png' width="80%">
<img src='https://raw.githubusercontent.com/Supergiovane/node-red-contrib-sonospollytts/master/img/Readme.png' width="80%">

@@ -21,167 +21,3 @@ <details><summary> VIEW SAMPLE CODE </summary>

```js
[
{
"id": "7948293a.159a68",
"type": "inject",
"z": "2a7223f6.d28e0c",
"name": "",
"topic": "",
"payload": "true",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 110,
"y": 140,
"wires": [
[
"140491c3.4c7e0e"
]
]
},
{
"id": "140491c3.4c7e0e",
"type": "function",
"z": "2a7223f6.d28e0c",
"name": "Sample function 1",
"func": "// The simplest way\nmsg.payload=\"Benvenuti,Wilkommen,Wellcome!\";\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 270,
"y": 140,
"wires": [
[
"b2f92147.9a31e"
]
]
},
{
"id": "b2f92147.9a31e",
"type": "sonospollytts",
"z": "2a7223f6.d28e0c",
"name": "",
"voice": "18",
"ssml": false,
"dir": "/tmp",
"sonosipaddress": "192.168.1.109 ",
"sonosvolume": "25",
"sonoshailing": "1",
"noderedipaddress": "192.168.1.209",
"noderedport": "1880",
"config": "e9b4b321.0bcb5",
"x": 490,
"y": 100,
"wires": [],
"icon": "node-red/leveldb.png"
},
{
"id": "21671071.2c082",
"type": "inject",
"z": "2a7223f6.d28e0c",
"name": "",
"topic": "",
"payload": "true",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 110,
"y": 180,
"wires": [
[
"f1cff68e.5c6a8"
]
]
},
{
"id": "f1cff68e.5c6a8",
"type": "function",
"z": "2a7223f6.d28e0c",
"name": "Sample function 2",
"func": "// Set the Volume\nmsg.volume=\"60\"; // If not set, will take the volume from setting page\nmsg.payload=\"Benvenuti,Wilkommen,Wellcome!\";\nreturn msg;\n\n",
"outputs": 1,
"noerr": 0,
"x": 270,
"y": 180,
"wires": [
[
"b2f92147.9a31e"
]
]
},
{
"id": "f42f5c8e.26a728",
"type": "inject",
"z": "2a7223f6.d28e0c",
"name": "",
"topic": "",
"payload": "true",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 110,
"y": 220,
"wires": [
[
"d6cbb03.bf40c5"
]
]
},
{
"id": "d6cbb03.bf40c5",
"type": "function",
"z": "2a7223f6.d28e0c",
"name": "Sample function 3",
"func": "// Create an array of messages\nvar aMessages=[];\n// Add random messages\naMessages.push({volume:\"50\",payload:\"Benvenuti.\"});\n// Wheater in Italy\naMessages.push({volume:\"40\",payload:\"http://media.ilmeteo.it/audio/2018-03-31.mp3\"});\n// Add random messages\naMessages.push({volume:\"30\",payload:\"Cambia la tua voce nei settaggi.\"});\nreturn [aMessages];\n",
"outputs": 1,
"noerr": 0,
"x": 270,
"y": 220,
"wires": [
[
"b2f92147.9a31e"
]
]
},
{
"id": "587710a4.938458",
"type": "inject",
"z": "2a7223f6.d28e0c",
"name": "Hello World",
"topic": "",
"payload": "Ciao Mondo! Come stai?",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 130,
"y": 100,
"wires": [
[
"b2f92147.9a31e"
]
]
},
{
"id": "f0e4fb09.e0fd1",
"type": "comment",
"z": "2a7223f6.d28e0c",
"name": "PUSH THE BUTTONS!",
"info": "",
"x": 120,
"y": 60,
"wires": []
},
{
"id": "e9b4b321.0bcb5",
"type": "sonospollytts-config",
"z": "",
"name": "bb"
}
]
[{"id":"ce10dd92.7ccb4","type":"inject","z":"6cf31700.e19548","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":240,"wires":[["8db04a6b.aa2458"]]},{"id":"8db04a6b.aa2458","type":"function","z":"6cf31700.e19548","name":"Via function","func":"// The simplest way\nmsg.payload=\"Benvenuti,Wilkommen,Wellcome!\";\nreturn msg;\n","outputs":1,"noerr":0,"x":390,"y":240,"wires":[["dcf2a25.b27346"]]},{"id":"dcf2a25.b27346","type":"sonospollytts","z":"6cf31700.e19548","name":"","voice":"18","ssml":false,"sonosipaddress":"192.168.1.109","sonosvolume":"25","sonoshailing":"Hailing_Hailing.mp3","config":"7182770d.79d208","propertyType":{},"rules":[],"x":630,"y":200,"wires":[[]],"icon":"node-red/leveldb.png"},{"id":"1c281b05.68270d","type":"inject","z":"6cf31700.e19548","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":280,"wires":[["59ff5539.fbf224"]]},{"id":"59ff5539.fbf224","type":"function","z":"6cf31700.e19548","name":"Set volume","func":"// Set the Volume\nmsg.volume=\"60\"; // If not set, will take the volume from setting page\nmsg.payload=\"Benvenuti,Wilkommen,Wellcome!\";\nreturn msg;\n\n","outputs":1,"noerr":0,"x":390,"y":280,"wires":[["dcf2a25.b27346"]]},{"id":"bc42af4c.7eab3","type":"inject","z":"6cf31700.e19548","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":250,"y":320,"wires":[["b5e7507e.0adef"]]},{"id":"b5e7507e.0adef","type":"function","z":"6cf31700.e19548","name":"Array of messages","func":"// Create an array of messages\nvar aMessages=[];\n// Add random messages\naMessages.push({volume:\"50\",payload:\"Benvenuti.\"});\n// Wheater in Italy\naMessages.push({volume:\"40\",payload:\"http://media.ilmeteo.it/audio/2018-03-31.mp3\"});\n// Add random messages\naMessages.push({volume:\"30\",payload:\"Cambia la tua voce nei settaggi.\"});\nreturn [aMessages];\n","outputs":1,"noerr":0,"x":410,"y":320,"wires":[["dcf2a25.b27346"]]},{"id":"15120425.9bcc3c","type":"inject","z":"6cf31700.e19548","name":"Hello World","topic":"","payload":"Ciao Mondo! Come stai?","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":200,"wires":[["dcf2a25.b27346"]]},{"id":"9f4872f4.12a4d8","type":"comment","z":"6cf31700.e19548","name":"Play text on Sonos. Single player or Group of players","info":"","x":380,"y":160,"wires":[]},{"id":"7182770d.79d208","type":"sonospollytts-config","z":"","name":"Config","noderedipaddress":"192.168.1.236","noderedport":"1980","accessKey":"","secretKey":"","purgediratrestart":"leave"}]
```

@@ -212,4 +48,19 @@ </details>

# SONOSPOLLYTTS CONFIGURATION
# SONOSPOLLYTTS-CONFIG NODE
**Node-Red IP**<br/>
set IP of your node-red machine
**Host Port**<br/>
normally 1980. This is the IP of your machine, running node-red
**TTS Cache**
<br/>
Purge and delete the TTS cache folder at deploy or restart(default): on each deploy or node-red restart, delete all tts files in the cache. This is useful not to run out of disk space, in case you've a lot of TTS speech files.<br/>
Leave the TTS cache folder untouched (not suggested if you have less disk space): don't delete any tts file. Useful if you wish to keep the tts files, even in case of internet outages.
# SONOSPOLLYTTS NODE
**Polly Config**<br/>

@@ -227,14 +78,3 @@ Create a config with your AWS credentials. If you put incorrect credentials, you'll see this error in the node-red's debug window: *"The security token included in the request is invalid."*

**Node-Red IP**<br/>
set IP of your node-red machine
**Host Port**<br/>
normally 1980. This is the IP of your machine, running node-red
**TTS Cache**
<br/>
Purge and delete the TTS cache folder at deploy or restart(default): on each deploy or node-red restart, delete all tts files in the cache. This is useful not to run out of disk space, in case you've a lot of TTS speech files.<br/>
Leave the TTS cache folder untouched (not suggested if you have less disk space): don't delete any tts file. Useful if you wish to keep the tts files, even in case of internet outages.
**Main Sonos Player** <br/>

@@ -248,3 +88,3 @@ Select your Sonos primary player. (It's strongly suggested to set a fixed IP for this player; you can reserve an IP using the DHCP Reservation function of your router/firewall's DHCP Server).<br/>

## INPUT MESSAGES TO THE NODE <br/>
# INPUT MESSAGES TO THE NODE <br/>

@@ -264,3 +104,3 @@ **msg.volume** set the volume (values between "0" and "100" with quotes)</br>

## OUTPUT MESSAGES FROM THE NODE
# OUTPUT MESSAGES FROM THE NODE

@@ -285,125 +125,3 @@ **msg.completed** "true" when the node has finished playing, <b>false</b> if the node is playing<br/>

```js
[
{
"id": "9389863f.c9e44",
"type": "sonospollytts",
"z": "2e6a2c30.383f64",
"name": "",
"purgediratrestart": "leave",
"voice": "51",
"ssml": false,
"dir": "/tmp",
"sonosipaddress": "192.168.1.109",
"sonosvolume": "20",
"sonoshailing": "0",
"noderedipaddress": "192.168.1.146",
"noderedport": "1980",
"config": "8194024b.fa7",
"x": 680,
"y": 340,
"wires": [
[]
]
},
{
"id": "90a05585.bc514",
"type": "ownfile",
"z": "2e6a2c30.383f64",
"name": "",
"selectedFile": "OwnFile_Tur geoeffnet.mp3",
"x": 310,
"y": 340,
"wires": [
[
"9389863f.c9e44"
]
]
},
{
"id": "d416ac1c.e5c8b",
"type": "inject",
"z": "2e6a2c30.383f64",
"name": "",
"topic": "",
"payload": "true",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 150,
"y": 340,
"wires": [
[
"90a05585.bc514"
]
]
},
{
"id": "3b08c36d.aba304",
"type": "comment",
"z": "2e6a2c30.383f64",
"name": "You can upload your own voice messages and use it with SonosPollyTTS",
"info": "",
"x": 340,
"y": 300,
"wires": []
},
{
"id": "b6061743.7f9ce",
"type": "ownfile",
"z": "2e6a2c30.383f64",
"name": "",
"selectedFile": "OwnFile_Tur geoeffnet.mp3",
"x": 410,
"y": 400,
"wires": [
[
"9389863f.c9e44"
]
]
},
{
"id": "6cac28fd.4088a8",
"type": "inject",
"z": "2e6a2c30.383f64",
"name": "",
"topic": "",
"payload": "true",
"payloadType": "bool",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 150,
"y": 400,
"wires": [
[
"fc569484.6604a8"
]
]
},
{
"id": "fc569484.6604a8",
"type": "function",
"z": "2e6a2c30.383f64",
"name": "",
"func": "// Override the selected file.\nmsg.selectedFile=\"Porta aperta\"\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 270,
"y": 400,
"wires": [
[
"b6061743.7f9ce"
]
]
},
{
"id": "8194024b.fa7",
"type": "sonospollytts-config",
"z": "",
"name": "asd"
}
]
[{"id":"9389863f.c9e44","type":"sonospollytts","z":"2e6a2c30.383f64","name":"","voice":"51","ssml":false,"sonosipaddress":"192.168.1.109","sonosvolume":"25","sonoshailing":"Hailing_Hailing.mp3","config":"7182770d.79d208","propertyType":{},"rules":[],"x":660,"y":340,"wires":[[]]},{"id":"90a05585.bc514","type":"ownfile","z":"2e6a2c30.383f64","name":"","selectedFile":"OwnFile_Tur geoeffnet.mp3","x":310,"y":340,"wires":[["9389863f.c9e44"]]},{"id":"d416ac1c.e5c8b","type":"inject","z":"2e6a2c30.383f64","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":340,"wires":[["90a05585.bc514"]]},{"id":"3b08c36d.aba304","type":"comment","z":"2e6a2c30.383f64","name":"You can upload your own voice messages and use it with SonosPollyTTS","info":"","x":340,"y":300,"wires":[]},{"id":"b6061743.7f9ce","type":"ownfile","z":"2e6a2c30.383f64","name":"","selectedFile":"OwnFile_Tur geoeffnet.mp3","x":410,"y":400,"wires":[["9389863f.c9e44"]]},{"id":"6cac28fd.4088a8","type":"inject","z":"2e6a2c30.383f64","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":400,"wires":[["fc569484.6604a8"]]},{"id":"fc569484.6604a8","type":"function","z":"2e6a2c30.383f64","name":"","func":"// Override the selected file.\nmsg.selectedFile=\"Porta aperta\"\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":400,"wires":[["b6061743.7f9ce"]]},{"id":"7182770d.79d208","type":"sonospollytts-config","z":"","name":"Config","noderedipaddress":"192.168.1.236","noderedport":"1980","accessKey":"","secretKey":"","purgediratrestart":"leave"}]
```

@@ -410,0 +128,0 @@ </details>

@@ -8,51 +8,2 @@

// 27/02/2020 Get list of filenames starting with OwnFile_
RED.httpAdmin.get("/getOwnFilesList", RED.auth.needsPermission('ownfile.read'), function (req, res) {
var jListOwnFiles = [];
var sName = "";
try {
fs.readdirSync(node.userDir + "/ttspermanentfiles").forEach(file => {
if (file.indexOf("OwnFile_") > -1) {
sName = file.replace("OwnFile_", '').replace(".mp3", '');
jListOwnFiles.push({ name: sName, filename: file });
}
});
} catch (error) { }
res.json(jListOwnFiles)
});
// 27/02/2020 Delete OwnFile_
RED.httpAdmin.get("/deleteOwnFile", RED.auth.needsPermission('ownfile.read'), function (req, res) {
try {
if (req.query.FileName == "DELETEallFiles") {
// Delete all OwnFiles_
try {
fs.readdir(node.userDir + "/ttspermanentfiles/", (err, files) => {
files.forEach(function (file) {
if (file.indexOf("OwnFile_") !== -1) {
RED.log.warn("SonospollyTTS: Deleted file " + node.userDir + "/ttspermanentfiles/" + file);
try {
fs.unlink(node.userDir + "/ttspermanentfiles/" + file), err => { };
} catch (error) { }
}
});
});
} catch (error) { }
} else {
// Delete only one file
try {
var newPath = node.userDir + "/ttspermanentfiles/" + req.query.FileName;
try {
fs.unlinkSync(newPath)
} catch (error) { }
} catch (error) { }
}
} catch (err) {
}
res.json({ status: 220 });
});
function ownfile(config) {

@@ -62,3 +13,4 @@ RED.nodes.createNode(this, config);

node.selectedFile = config.selectedFile || "";
node.userDir = RED.settings.userDir + "/sonospollyttsstorage"; // 09/03/2020 Storage of sonospollytts
// Receive new files from html

@@ -79,2 +31,54 @@ RED.httpAdmin.post("/node-red-contrib-sonospollytts", function (req, res) {

// 27/02/2020 Get list of filenames starting with OwnFile_
RED.httpAdmin.get("/getOwnFilesList", RED.auth.needsPermission('ownfile.read'), function (req, res) {
var jListOwnFiles = [];
var sName = "";
try {
fs.readdirSync(node.userDir + "/ttspermanentfiles").forEach(file => {
if (file.indexOf("OwnFile_") > -1) {
sName = file.replace("OwnFile_", '').replace(".mp3", '');
jListOwnFiles.push({ name: sName, filename: file });
}
});
} catch (error) { }
res.json(jListOwnFiles)
});
// 27/02/2020 Delete OwnFile_
RED.httpAdmin.get("/deleteOwnFile", RED.auth.needsPermission('ownfile.read'), function (req, res) {
try {
if (req.query.FileName == "DELETEallFiles") {
// Delete all OwnFiles_
try {
fs.readdir(node.userDir + "/ttspermanentfiles/", (err, files) => {
files.forEach(function (file) {
if (file.indexOf("OwnFile_") !== -1) {
RED.log.warn("SonospollyTTS: Deleted file " + node.userDir + "/ttspermanentfiles/" + file);
try {
fs.unlink(node.userDir + "/ttspermanentfiles/" + file), err => { };
} catch (error) { }
}
});
});
} catch (error) { }
} else {
// Delete only one file
try {
var newPath = node.userDir + "/ttspermanentfiles/" + req.query.FileName;
try {
fs.unlinkSync(newPath)
} catch (error) { }
} catch (error) { }
}
} catch (err) {
}
res.json({ status: 220 });
});
this.on('input', function (msg) {

@@ -81,0 +85,0 @@ if (msg.hasOwnProperty("selectedFile")) {

@@ -477,39 +477,8 @@ module.exports = function (RED) {

// Configuration Node Register
function PollyConfigNode(config) {
RED.nodes.createNode(this, config);
if (this.credentials) {
this.accessKey = this.credentials.accessKey;
this.secretKey = this.credentials.secretKey;
}
var params = {
accessKeyId: this.accessKey,
secretAccessKey: this.secretKey,
apiVersion: '2016-06-10'
};
this.polly = new AWS.Polly(params);
}
//RED.nodes.registerType('sonospollytts-config', PollyConfigNode);
RED.nodes.registerType('sonospollytts-config', PollyConfigNode, {
credentials: {
accessKey: {
type: 'text'
},
secretKey: {
type: 'password'
}
}
});
// Node Register
function PollyNode(config) {
RED.nodes.createNode(this, config);
var node = this;
var node = this
node.server = RED.nodes.getNode(config.config)
node.sPollyState = "done";

@@ -529,17 +498,9 @@ node.iTimeoutPollyState = 0;

node.msg = {}; // 08/05/2019 Node message
node.oWebserver; // 11/11/2019 Stores the Webserver
node.msg.completed = true;
node.msg.connectionerror = true;
node.purgediratrestart = config.purgediratrestart || "purge"; // 26/02/2020
node.userDir = RED.settings.userDir + "/sonospollyttsstorage"; // 09/03/2020 Storage of sonospollytts (otherwise, at each upgrade to a newer version, the node path is wiped out and recreated, loosing all custom files)
node.oAdditionalSonosPlayers = []; // 20/03/2020 Contains other players to be grouped
node.rules = config.rules || [{}];
// 11/11/2019 NEW in V 1.1.0, changed webserver behaviour. Redirect pre V. 1.1.0 1880 ports to the nde default 1980
if (config.noderedport.trim() == "1880") {
RED.log.warn("SonosPollyTTS: The webserver port ist 1880. Please change it to another port, not to conflict with default node-red 1880 port. I've changed this temporarly for you to 1980");
config.noderedport = "1980";
}
node.sNoderedURL = "http://" + config.noderedipaddress.trim() + ":" + config.noderedport.trim(); // 11/11/2019 New Endpoint to overcome https problem.
RED.log.info('SonosPollyTTS: Node-Red node.js Endpoint will be created here: ' + node.sNoderedURL + "/tts");
node.sNoderedURL = node.server.sNoderedURL || "";

@@ -552,3 +513,2 @@ // 20/03/2020 in the middle of coronavirus, get the sonos groups

discovery.discover().then((device, model) => {
RED.log.warn('Found one sonos device ' + device.host + ' getting all groups')
return device.getAllGroups().then((groups) => {

@@ -564,3 +524,3 @@ //RED.log.warn('Groups ' + JSON.stringify(groups, null, 2))

}).catch(e => {
RED.log.warn(' Error in discovery ' + e)
RED.log.warn('SonosPollyTTS: Error in discovery ' + e)
})

@@ -650,21 +610,3 @@ } catch (error) { }

// 26/02/2020
if (node.purgediratrestart === "purge") {
// Delete all files, that are'nt OwnFiles_
try {
fs.readdir(node.userDir + "/ttsfiles/", (err, files) => {
if (files.length > 0) {
files.forEach(function (file) {
RED.log.info("SonospollyTTS: Deleted TTS file " + node.userDir + "/ttsfiles/" + file);
try {
fs.unlink(node.userDir + "/ttsfiles/" + file), err => { };
} catch (error) {
}
});
};
});
} catch (error) { }
};
// Set ssml

@@ -828,68 +770,7 @@ node.ssml = config.ssml;

// 11/11/2019 CREATE THE ENDPOINT
// #################################
const http = require('http')
const sWebport = config.noderedport.trim();
const requestHandler = (req, res) => {
try {
var url = require('url');
var url_parts = url.parse(req.url, true);
var query = url_parts.query;
res.setHeader('Content-Disposition', 'attachment; filename=tts.mp3')
if (fs.existsSync(query.f)) {
var readStream = fs.createReadStream(query.f);
readStream.on("error", function (err) {
fine(err);
});
readStream.pipe(res);
res.end;
} else {
RED.log.error("Playsonos RED.httpAdmin file not found: " + query.f);
res.write("File not found");
res.end();
}
} catch (error) {
RED.log.error("Playsonos RED.httpAdmin error: " + error + " on: " + query.f);
}
function fine(err) {
RED.log.error("Playsonos error opening stream : " + query.f + ' : ' + error);
res.end;
}
}
try {
node.oWebserver = http.createServer(requestHandler);
node.oWebserver.on('error', function (e) {
RED.log.error("SonosPollyTTS: " + node.ID + " error starting webserver on port " + sWebport + " " + e);
node.setNodeStatus({
fill: 'red',
shape: 'dot',
text: 'Error. Port ' + sWebport + " already in use."
});
});
} catch (error) {
// Already open. Close it and redo.
RED.log.error("SonosPollyTTS: Webserver creation error: " + error);
}
try {
node.oWebserver.listen(sWebport, (err) => {
if (err) {
RED.log.error("SonosPollyTTS: error listening webserver on port " + sWebport + " " + err);
}
});
} catch (error) {
// In case oWebserver is null
RED.log.error("SonosPollyTTS: error listening webserver on port " + sWebport + " " + error);
}
// #################################
}

@@ -896,0 +777,0 @@ RED.nodes.registerType('sonospollytts', PollyNode);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc