node-red-contrib-sonospollytts
Advanced tools
Comparing version 1.1.34 to 1.1.35
@@ -6,2 +6,7 @@ ![Sample Node](img/logo.png) | ||
<p> | ||
<b>Version 1.1.35</b> October 2020<br/> | ||
- HOTFIX: Fix possible polly voice discovery issues if running in docker or under homeassistant.<br/> | ||
- Added a warning to restart node-red after each change in the config window.<br/> | ||
</p> | ||
<p> | ||
<b>Version 1.1.34</b> October 2020<br/> | ||
@@ -8,0 +13,0 @@ - HOTFIX: Fix possible sonos discovery issue<br/> |
{ | ||
"name": "node-red-contrib-sonospollytts", | ||
"version": "1.1.34", | ||
"version": "1.1.35", | ||
"description": "Node-Red TTS with Sonos and Amazon Polly or with your own local mp3 announcement files. Transforms the text in speech and hear it using Sonos player. Can work OFFLINE as well! This node is specific for security alarm announcement, doorbell, weather annoucement etc.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,3 +10,3 @@ module.exports = function (RED) { | ||
const sonos = require('sonos'); | ||
AWS.config.update({ | ||
@@ -27,4 +27,41 @@ region: 'us-east-1' | ||
node.polly = new AWS.Polly(params); | ||
// 28/10/2020 Refresh polly voices | ||
// node.refreshVoices = function () { | ||
// return new Promise((resolve, reject) => { | ||
// var jListVoices = []; | ||
// try { | ||
// // https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Polly.html#describeVoices-property | ||
// var jfiltroVoci = { | ||
// //Engine: standard | neural, | ||
// //IncludeAdditionalLanguageCodes: true | ||
// //LanguageCode: arb | cmn-CN | cy-GB | da-DK | de-DE | en-AU | en-GB | en-GB-WLS | en-IN | en-US | es-ES | es-MX | es-US | fr-CA | fr-FR | is-IS | it-IT | ja-JP | hi-IN | ko-KR | nb-NO | nl-NL | pl-PL | pt-BR | pt-PT | ro-RO | ru-RU | sv-SE | tr-TR, | ||
// //NextToken: "STRING_VALUE" | ||
// }; | ||
// node.polly.describeVoices(jfiltroVoci, function (err, data) { | ||
// if (err) { | ||
// RED.log.warn('SonosPollyTTS: Error getting polly voices ' + err); | ||
// jListVoices.push({ name: "Error retrieving voices. Check your AWS credentials and full deploy again", id: "Ivy" }) | ||
// reject(jListVoices); | ||
// } else { | ||
// for (let index = 0; index < data.Voices.length; index++) { | ||
// const oVoice = data.Voices[index]; | ||
// jListVoices.push({ name: oVoice.LanguageName + " (" + oVoice.LanguageCode + ") " + oVoice.Name + " - " + oVoice.Gender, id: oVoice.Id }) | ||
// //RED.log.info("BANANA VOCE AGGIUNTA " + oVoice.Name); | ||
// } | ||
// resolve(jListVoices); | ||
// } | ||
// }); | ||
// } catch (error) { | ||
// jListVoices.push({ name: "Error " + error, id: "Ivy" }) | ||
// reject(jListVoices); | ||
// } | ||
// }); | ||
// }; | ||
node.userDir = path.join(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) | ||
// 03/06/2019 you can select the temp dir | ||
//#region "SETUP PATHS" | ||
// 26/10/2020 Check for path and create it if doens't exists | ||
@@ -43,4 +80,2 @@ function setupDirectory(_aPath) { | ||
} | ||
// 03/06/2019 you can select the temp dir | ||
if (!setupDirectory(node.userDir)) { | ||
@@ -76,2 +111,3 @@ RED.log.error('SonosPollyTTS: Unable to set up MAIN directory: ' + node.userDir); | ||
} | ||
//#endregion | ||
@@ -169,5 +205,11 @@ //#region SONOSPOLLY NODE | ||
}); | ||
// 26/10/2020 Supergiovane, get the real updated voice list. | ||
RED.httpAdmin.get("/pollygetvoices", RED.auth.needsPermission('PollyConfigNode.read'), function (req, res) { | ||
// 26/10/2020 Supergiovane, get the real updated voice list. | ||
RED.httpAdmin.get("/pollygetvoices", RED.auth.needsPermission('PollyConfigNode.read'), function (req, res) { | ||
// node.refreshVoices().then(function (resolve) { | ||
// res.json(resolve); | ||
// }).catch(function (reject) { | ||
// res.json(reject); | ||
// }); | ||
var jListVoices = []; | ||
@@ -185,2 +227,4 @@ try { | ||
RED.log.warn('SonosPollyTTS: Error getting polly voices ' + err); | ||
jListVoices.push({ name: "Error retrieving voices. Check your AWS credentials and restart node-red", id: "Ivy" }) | ||
res.json(jListVoices) | ||
} else { | ||
@@ -195,3 +239,6 @@ for (let index = 0; index < data.Voices.length; index++) { | ||
} catch (error) { } | ||
} catch (error) { | ||
jListVoices.push({ name: "Error " + error, id: "Ivy" }) | ||
res.json(jListVoices) | ||
} | ||
}); | ||
@@ -203,3 +250,3 @@ | ||
//#region OWNFILE NODE | ||
@@ -206,0 +253,0 @@ // ###################################################### |
module.exports = function (RED) { | ||
'use strict'; | ||
var AWS = require('aws-sdk'); | ||
//var AWS = require('aws-sdk'); | ||
var fs = require('fs'); | ||
@@ -12,5 +12,5 @@ var MD5 = require('crypto-js').MD5; | ||
AWS.config.update({ | ||
region: 'us-east-1' | ||
}); | ||
// AWS.config.update({ | ||
// region: 'us-east-1' | ||
// }); | ||
@@ -17,0 +17,0 @@ function slug(_text) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
856733
1453