node-red-contrib-tts-ultimate 1.0.48 → 1.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,19 @@
2
2
 
3
3
  [![Donate via PayPal](https://img.shields.io/badge/Donate-PayPal-blue.svg?style=flat-square)](https://www.paypal.me/techtoday)
4
4
 
5
-
5
+ <p>
6
+ <b>Version 1.0.51</b> September 2022<br/>
7
+ - Updated microsoft azure sdk for compatibility with node 16.17.0<br/>
8
+ </p>
9
+ <p>
10
+ <b>Version 1.0.50</b> August 2022<br/>
11
+ - Fixed a wrong "sonos unreachable" message when you select to simply save the file instead of using it with sonos<br/>
12
+ - FIX: temporary fix for chinese language in google translate engine, that was not working anymore.<br/>
13
+ </p>
14
+ <p>
15
+ <b>Version 1.0.49</b> June 2022<br/>
16
+ - Due to Microsoft Azure SDK limitation, the node can only be installed on systems with NodeJS versions: (^12.22.0, ^14.17.0, or >=16.0.0) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.). Currently, the Microsoft Azure SDK and, thus, TTS-Ultimate, doesn't run on NodeJS 18.x.x !!<br/>
17
+ </p>
6
18
  <p>
7
19
  <b>Version 1.0.48</b> Mai 2022<br/>
8
20
  - Try to fixe a clunky issue with microsoft azure package, on nodejs versions that are not supported by Microsoft.<br/>
package/README.md CHANGED
@@ -20,6 +20,8 @@
20
20
  ```
21
21
  </details>
22
22
 
23
+ ## WARNING
24
+ Due to Microsoft Azure SDK limitation, the node can only be installed on systems with **NodeJS** versions: (^12.22.0, ^14.17.0, or >=16.0.0) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.). Currently, the **Microsoft Azure SDK and, thus, TTS-Ultimate, doesn't run on NodeJS 18.x.x !!**
23
25
 
24
26
  ## DESCRIPTION
25
27
  This node transforms a text into a speech audio that you can hear natively via <b>SONOS</b> speakers.<br/>
@@ -27,7 +29,7 @@ You can also generate an audio file for bluetooth speakers, web pages, etc.<br/>
27
29
  Uses Amazon Polly (standard and neural engines), Google TTS voices (even without credentials nor registration) and Microsoft TTS Azure voices, and you can use it with **your own audio file** as well and it can be used **totally offline** even without the use of TTS, without internet connection.<br/>
28
30
  The node can also create a ***TTS file (without the use of any Sonos device)***, to be read by third parties nodes.<br/>
29
31
  This is a major ***upgrade from the previously popular node SonosPollyTTS*** (SonosPollyTTS is not developed anymore).<br/>
30
- **Node v.12.0.0 or newer is needed**.
32
+
31
33
 
32
34
  [![Donate via PayPal](https://img.shields.io/badge/Donate-PayPal-blue.svg?style=flat-square)](https://www.paypal.me/techtoday)
33
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-tts-ultimate",
3
- "version": "1.0.48",
3
+ "version": "1.0.51",
4
4
  "description": "Transforms the text in speech and hear it using Sonos player or generate an audio file to be used with third parties nodes. Works with voices from Amazon, Google (without credentials as well), Microsoft TTS Azure, or your own voice. You can also only create a TTS file to be read by third party nodes. Update of the popular SonosPollyTTS node.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -47,8 +47,8 @@
47
47
  "os": ">=0.1.1",
48
48
  "path": ">=0.12.7",
49
49
  "@google-cloud/text-to-speech": "3.4.0",
50
- "google-translate-tts": ">=0.2.1",
51
- "microsoft-cognitiveservices-speech-sdk": "1.19.0"
50
+ "google-translate-tts": ">=0.3.0",
51
+ "microsoft-cognitiveservices-speech-sdk": "1.23.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "eslint": ">=4.18.2",
@@ -1,6 +1,16 @@
1
+ const { Redshift } = require('aws-sdk');
2
+
1
3
  module.exports = function (RED) {
2
4
  'use strict';
3
5
 
6
+ // 31/05/2022 checking nodejs version due to Microsoft Azure SDK bad nodejs compatibility.
7
+ let nodejsVersion = process.version.match(/^v(\d+\.\d+)/)[1];
8
+ if (nodejsVersion.startsWith("18")) {
9
+ RED.log.error('ttsultimate-config: YOUR NODEJS VERSION IS CURRENTLY INCOMPATIBLE WITH Microsoft Azure SDK. Your NodeJS version: ' + nodejsVersion + ", please install one of these: (^12.22.0, ^14.17.0, or >=16.0.0), with SSL support.");
10
+ }
11
+
12
+
13
+
4
14
  const AWS = require('aws-sdk');
5
15
  const GoogleTTS = require('@google-cloud/text-to-speech');
6
16
  const GoogleTranslate = require('google-translate-tts'); // TTS without credentials, limited to 200 chars per row.
@@ -27,10 +37,7 @@ module.exports = function (RED) {
27
37
  node.whoIsUsingTheServer = ""; // Client node.id using the server, because only a ttsultimate node can use the serve at once.
28
38
  node.ttsservice = config.ttsservice || "googletranslate";
29
39
  node.TTSRootFolderPath = (config.TTSRootFolderPath === undefined || config.TTSRootFolderPath === "") ? path.join(RED.settings.userDir, "sonospollyttsstorage") : path.join(config.TTSRootFolderPath, "sonospollyttsstorage");
30
- // node.polly = null;
31
- // node.googleTTS = null;
32
- // node.googleTranslateTTS = null;
33
- // node.microsoftAzureTTS = null;
40
+
34
41
 
35
42
  // 03/06/2019 you can select the temp dir
36
43
  //#region "SETUP PATHS"
@@ -236,12 +243,12 @@ module.exports = function (RED) {
236
243
  })
237
244
  } catch (error) { }
238
245
  if (jListInterfaces.length > 0) {
239
- return(jListInterfaces[0].address); // Retunr the first usable IP
246
+ return (jListInterfaces[0].address); // Retunr the first usable IP
240
247
  } else {
241
- return("NO ETH INTERFACE FOUND");
248
+ return ("NO ETH INTERFACE FOUND");
242
249
  }
243
250
  }
244
-
251
+
245
252
  // 20/03/2020 in the middle of coronavirus, get the sonos groups
246
253
  RED.httpAdmin.get("/sonosgetAllGroups", RED.auth.needsPermission('TTSConfigNode.read'), function (req, res) {
247
254
  var jListGroups = [];
@@ -285,7 +285,7 @@ module.exports = function (RED) {
285
285
  // 30/03/2020 in the middle of coronavirus emergency. Group Speakers
286
286
  for (let index = 0; index < node.oAdditionalSonosPlayers.length; index++) {
287
287
  let element = node.oAdditionalSonosPlayers[index].oPlayer;
288
-
288
+
289
289
  // 02/07/2021 Get the additional's player's volume set by app and the current track, to be set again in ungroupspealers
290
290
  try {
291
291
  element.additionalPlayerPreviousVolumeSetByApp = await element.getVolume();
@@ -366,29 +366,35 @@ module.exports = function (RED) {
366
366
 
367
367
 
368
368
  // 27/11/2019 Check Sonos connection health
369
- node.CheckSonosConnection = () => {
370
369
 
371
- node.SonosClient.getCurrentState().then(state => {
370
+ node.CheckSonosConnection = () => {
371
+ if (node.playertype !== "noplayer") {
372
+ node.SonosClient.getCurrentState().then(state => {
373
+
374
+ // 11/12/202020 The connection with Sonos is OK.
375
+ if (node.msg.connectionerror == true) {
376
+ node.flushQueue();
377
+ node.setNodeStatus({ fill: "green", shape: "dot", text: "Sonos is connected." });
378
+ node.msg.connectionerror = false;
379
+ node.send([null, { payload: node.msg.connectionerror }]);
380
+ }
381
+ node.oTimerSonosConnectionCheck = setTimeout(function () { node.CheckSonosConnection(); }, 5000);
372
382
 
373
- // 11/12/202020 The connection with Sonos is OK.
374
- if (node.msg.connectionerror == true) {
383
+ }).catch(err => {
384
+ node.setNodeStatus({ fill: "red", shape: "dot", text: "Sonos connection is DOWN: " + err.message });
375
385
  node.flushQueue();
376
- node.setNodeStatus({ fill: "green", shape: "dot", text: "Sonos is connected." });
377
- node.msg.connectionerror = false;
378
- node.send([null, { payload: node.msg.connectionerror }]);
379
- }
380
- node.oTimerSonosConnectionCheck = setTimeout(function () { node.CheckSonosConnection(); }, 5000);
381
-
382
- }).catch(err => {
383
- node.setNodeStatus({ fill: "red", shape: "dot", text: "Sonos connection is DOWN: " + err.message });
384
- node.flushQueue();
385
- // 11/12/2020 Set node output to signal connectio error
386
- if (node.msg.connectionerror == false) {
387
- node.msg.connectionerror = true;
388
- node.send([null, { payload: node.msg.connectionerror }]);
389
- }
390
- node.oTimerSonosConnectionCheck = setTimeout(function () { node.CheckSonosConnection(); }, 10000);
391
- });
386
+ // 11/12/2020 Set node output to signal connectio error
387
+ if (node.msg.connectionerror == false) {
388
+ node.msg.connectionerror = true;
389
+ node.send([null, { payload: node.msg.connectionerror }]);
390
+ }
391
+ node.oTimerSonosConnectionCheck = setTimeout(function () { node.CheckSonosConnection(); }, 10000);
392
+ });
393
+ } else {
394
+ node.setNodeStatus({ fill: "green", shape: "dot", text: "Sonos is connected." });
395
+ node.msg.connectionerror = false;
396
+ node.send([null, { payload: node.msg.connectionerror }]);
397
+ }
392
398
 
393
399
  }
394
400
 
@@ -614,6 +620,7 @@ module.exports = function (RED) {
614
620
  } else if (node.server.ttsservice === "googletranslate") {
615
621
  node.setNodeStatus({ fill: 'green', shape: 'ring', text: 'Downloading from Google Translate...' });
616
622
  // VoiceId is: code. SSML is not supported by google translate
623
+ if (node.voiceId === "cmn-Hant-TW") node.voiceId = "zh-CN"; // 06/08/2022 fix for a wrong voiceid sent by google translate as voice code
617
624
  const params = {
618
625
  text: msg,
619
626
  voice: node.voiceId,
@@ -894,7 +901,7 @@ module.exports = function (RED) {
894
901
  // *********************************
895
902
 
896
903
  // In case of connection error, doesn't accept any message
897
- if (node.msg.connectionerror) {
904
+ if (node.msg.connectionerror && node.playertype !== "noplayer") {
898
905
  RED.log.warn("ttsultimate: Sonos is offline. The new msg coming from the flow will be rejected.");
899
906
  node.setNodeStatus({ fill: 'red', shape: 'ring', text: "Sonos is offline. The msg has been rejected." });
900
907
  return;