node-red-contrib-tts-ultimate 2.0.4 → 2.0.6
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,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.paypal.me/techtoday)
|
|
4
4
|
|
|
5
|
+
<p>
|
|
6
|
+
<b>Version 2.0.6</b> January 2024<br/>
|
|
7
|
+
- Minor fixes.<br/>
|
|
8
|
+
- Moved log into the log tab of node-red.<br/>
|
|
9
|
+
</p>
|
|
10
|
+
<p>
|
|
11
|
+
<b>Version 2.0.5</b> October 2023<br/>
|
|
12
|
+
- Speed up emitting msg, when not using Sonos.<br/>
|
|
13
|
+
</p>
|
|
5
14
|
<p>
|
|
6
15
|
<b>Version 2.0.4</b> August 2023<br/>
|
|
7
16
|
- Removed unused new AWS api.<br/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-tts-ultimate",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
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, ElevenLabs.io TTS 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": {
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"homepage": "https://github.com/Supergiovane/node-red-contrib-tts-ultimate",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"aws-sdk": "2.1444.0",
|
|
44
|
-
|
|
45
44
|
"fs": "0.0.1-security",
|
|
46
45
|
"sonos": "1.14.1",
|
|
47
46
|
"formidable": "1.2.2",
|
|
@@ -49,7 +48,7 @@
|
|
|
49
48
|
"@google-cloud/text-to-speech": "4.2.2",
|
|
50
49
|
"google-translate-tts": ">=0.3.0",
|
|
51
50
|
"microsoft-cognitiveservices-speech-sdk": "1.29.0",
|
|
52
|
-
"elevenlabs-node":"1.1.3"
|
|
51
|
+
"elevenlabs-node": "1.1.3"
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
55
54
|
"eslint": ">=4.18.2",
|
|
@@ -58,4 +57,4 @@
|
|
|
58
57
|
"engines": {
|
|
59
58
|
"node": ">=14.0.0"
|
|
60
59
|
}
|
|
61
|
-
}
|
|
60
|
+
}
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
secretKey: { type: "password" },
|
|
28
28
|
mssubscriptionKey: { type: "text" },
|
|
29
29
|
mslocation: { type: "text" },
|
|
30
|
-
elevenlabsKey:{ type: "text" }
|
|
30
|
+
elevenlabsKey: { type: "text" }
|
|
31
31
|
},
|
|
32
32
|
label: function () {
|
|
33
33
|
return this.name || "";
|
|
@@ -66,28 +66,28 @@
|
|
|
66
66
|
if ($("#node-config-input-ttsservice").val() == "polly") {
|
|
67
67
|
$("#GoogleForm").hide();
|
|
68
68
|
$("#microsoftAzureForm").hide();
|
|
69
|
-
$("#elevenlabsForm").hide();
|
|
69
|
+
$("#elevenlabsForm").hide();
|
|
70
70
|
$("#pollyForm").show();
|
|
71
71
|
} else if ($("#node-config-input-ttsservice").val() == "googletts") {
|
|
72
72
|
$("#microsoftAzureForm").hide();
|
|
73
73
|
$("#pollyForm").hide();
|
|
74
|
-
$("#elevenlabsForm").hide();
|
|
74
|
+
$("#elevenlabsForm").hide();
|
|
75
75
|
$("#GoogleForm").show();
|
|
76
76
|
} else if ($("#node-config-input-ttsservice").val() == "googletranslate") {
|
|
77
77
|
$("#pollyForm").hide();
|
|
78
78
|
$("#GoogleForm").hide();
|
|
79
79
|
$("#microsoftAzureForm").hide();
|
|
80
|
-
$("#elevenlabsForm").hide();
|
|
80
|
+
$("#elevenlabsForm").hide();
|
|
81
81
|
} else if ($("#node-config-input-ttsservice").val() == "microsoftazuretts") {
|
|
82
82
|
$("#pollyForm").hide();
|
|
83
83
|
$("#GoogleForm").hide();
|
|
84
|
-
$("#elevenlabsForm").hide();
|
|
84
|
+
$("#elevenlabsForm").hide();
|
|
85
85
|
$("#microsoftAzureForm").show();
|
|
86
86
|
} else if ($("#node-config-input-ttsservice").val() == "elevenlabs") {
|
|
87
87
|
$("#pollyForm").hide();
|
|
88
88
|
$("#GoogleForm").hide();
|
|
89
89
|
$("#microsoftAzureForm").hide();
|
|
90
|
-
$("#elevenlabsForm").show();
|
|
90
|
+
$("#elevenlabsForm").show();
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
// ##########################################################
|
|
@@ -238,11 +238,86 @@
|
|
|
238
238
|
|
|
239
239
|
|
|
240
240
|
<script type="text/markdown" data-help-name="ttsultimate-config">
|
|
241
|
+
<p>Here you can configure your TTS engine to be used.</p>
|
|
242
|
+
|
|
243
|
+
# TTS Service node
|
|
244
|
+
Here you can set all parameters you need. All nodes will refer to this config node, so you need to set it only once.<br/>
|
|
245
|
+
IF YOU RUN NODE-RED BEHIND DOCKER OR SOMETHING ELSE, BE AWARE: <br/>
|
|
246
|
+
PORT USED BY THE NODE ARE 1980 (DEFAULT) AND 1400 (FOR SONOS DISCOVER). <br/>
|
|
247
|
+
PLEASE ALLOW MDNS AND UDP AS WELL
|
|
248
|
+
|
|
249
|
+
**TTS Service**<br/>
|
|
250
|
+
You can choose between Google (without credentials), Amazon AWS (Polly), Google TTS (require credentials and registration to google) or Microsoft Azure TTS engines.<br/>
|
|
251
|
+
For Google TTS Engine, you can choose pitch and speed rate of the voice.
|
|
252
|
+
<br/>
|
|
253
|
+
<br/>
|
|
254
|
+
|
|
255
|
+
* **TTS Service using Amazon AWS (Polly)**<br/>
|
|
256
|
+
> HOW-TO in Deutsch: for german users, there is a very helpful how-to, where you can learn how to use the node and how to register to Amazon AWS Polly as well: here: https://technikkram.net/blog/2020/09/26/sonos-sprachausgabe-mit-raspberry-pi-node-red-und-amazon-polly-fuer-homematic-oder-knx-systeme
|
|
257
|
+
|
|
258
|
+
**AWS Access key**<br/>
|
|
259
|
+
AWS access key credential
|
|
260
|
+
<br/><br/>
|
|
261
|
+
**AWS Secret key**<br/>
|
|
262
|
+
AWS access Secret key.
|
|
263
|
+
<br/>
|
|
264
|
+
|
|
265
|
+
* **TTS Service using Google (without credentials)**<br/>
|
|
266
|
+
This is the simplest way. Just select the voice and you're done. You don't need any credential and you don't even need to be registered to any google service. The voice list is more limited than other services, but it works without hassles.
|
|
267
|
+
|
|
268
|
+
<br/>
|
|
269
|
+
|
|
270
|
+
* **TTS Service using Google TTS**<br/>
|
|
271
|
+
For Google TTS Engine, you can choose pitch and speed rate of the voice.<br/>
|
|
272
|
+
**Google credentials file path**<br/>
|
|
273
|
+
Here you must select your credential file, previously downloaded from Google, [with these steps](https://www.npmjs.com/package/@google-cloud/text-to-speech):
|
|
274
|
+
> [Select or create a Cloud Platform project](https://console.cloud.google.com/project)<br/>
|
|
275
|
+
> [Enable billing for your project](https://support.google.com/cloud/answer/6293499#enable-billing)<br/>
|
|
276
|
+
> [Enable the Google Cloud Text-to-Speech API](https://console.cloud.google.com/flows/enableapi?apiid=texttospeech.googleapis.com)<br/>
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
<br/>
|
|
280
|
+
|
|
281
|
+
* **TTS Service using Microsot Azure TTS**<br/>
|
|
282
|
+
For Microsoft Azure TTS Engine, you need to have a microsoft account and register to the Azure portal.<br/>
|
|
283
|
+
See my **YOUTUBE video**, here! https://youtu.be/asXajNpRWME<br/>
|
|
284
|
+
You need to register here https://portal.azure.com, then ceate a Voice Service (please click here https://portal.azure.com/#create/Microsoft.CognitiveServicesSpeechServices), then click on the left "Keys and Endpoint" menu and copy/paste the KEY and your Location (for example westus).<br/>
|
|
285
|
+
Then paste both into the TTS-Ultimate engine configuration window and restart node-red.<br/>
|
|
286
|
+
|
|
287
|
+
<br/>
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
**Node-Red IP**<br/>
|
|
291
|
+
set IP of your node-red machine. Write **AUTODISCOVER** to allow the node to auto discover your IP.
|
|
292
|
+
|
|
293
|
+
**Host Port**<br/>
|
|
294
|
+
Sonos will connect to this port in order to play TTS. Default 1980. Choose a free port. Do not use 1880 or any other port already in use on your computer.
|
|
295
|
+
|
|
296
|
+
**TTS Cache**
|
|
297
|
+
<br/>
|
|
298
|
+
***Purge and delete the TTS cache folder at deploy or restart***<br/>
|
|
299
|
+
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.
|
|
300
|
+
<br/>
|
|
301
|
+
***Leave the TTS cache folder untouched*** (suggested only if you have enough disk space)<br/>
|
|
302
|
+
Don't delete the files cached. Useful if you wish to keep the tts files, even in case of internet outages, node-red restart or reboots.
|
|
303
|
+
<br/>
|
|
304
|
+
|
|
305
|
+
**Cache root folder**
|
|
306
|
+
<br/>
|
|
307
|
+
Set your preferred output folder for the files downloaded by the TTS Engine.<br/>
|
|
308
|
+
This is useful if you wish to save the TTS cached files in a folder accessible, for example, by a third party web servers to serve an AirPlay2 speaker.<br/>
|
|
309
|
+
Leave this field blank for the default.<br/>
|
|
310
|
+
<br/>
|
|
311
|
+
<br/>
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
241
316
|
<p>
|
|
242
317
|
<a href="https://www.paypal.me/techtoday" target="_blank"><img src='https://img.shields.io/badge/Donate-PayPal-blue.svg?style=flat-square' width='30%'></a>
|
|
243
318
|
</p>
|
|
244
319
|
<p>
|
|
245
|
-
Configuration help is
|
|
320
|
+
Configuration help is also here <a href="https://github.com/Supergiovane/node-red-contrib-tts-ultimate/blob/master/README.md">README</a><br/>
|
|
246
321
|
</p>
|
|
247
322
|
|
|
248
323
|
</script>
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
<label for="node-input-sonoshailing"><i class="fa fa-bell"></i> Hailing</label>
|
|
51
51
|
<select id="node-input-sonoshailing"></select> <input id="deleteSelectedFile" type="button" value="DELETE" style="width:100px">
|
|
52
52
|
</div>
|
|
53
|
+
<div class="form-row">
|
|
54
|
+
<label><i class="fa fa-upload"></i> Upload hail</label>
|
|
55
|
+
<input id="ownFileUpload" type="file" multiple="multiple">
|
|
56
|
+
</div>
|
|
53
57
|
<div class="form-row">
|
|
54
58
|
<label for="node-input-playertype"><i class="fa fa-play"></i> Player</label>
|
|
55
59
|
<select id="node-input-playertype">
|
|
@@ -68,10 +72,6 @@
|
|
|
68
72
|
<input type="checkbox" id="node-input-unmuteIfMuted" style="margin-left: 0px; vertical-align: top; width: auto !important;"> <label style="width:auto !important;"> Unmute, then restore previous state after play.</label>
|
|
69
73
|
</div>
|
|
70
74
|
|
|
71
|
-
<div class="form-row">
|
|
72
|
-
<label><i class="fa fa-upload"></i> Upload hail</label>
|
|
73
|
-
<input id="ownFileUpload" type="file" multiple="multiple">
|
|
74
|
-
</div>
|
|
75
75
|
<div class="form-row">
|
|
76
76
|
<label for="node-input-sonosipaddress"><i class="fa fa-globe"></i> Main Sonos Player</label>
|
|
77
77
|
<label style="width:200px;" id="node-input-sonosipaddress">Discovering.... wait...</label>
|
|
@@ -178,11 +178,11 @@
|
|
|
178
178
|
} else if (oNodeServer.ttsservice === "elevenlabs") {
|
|
179
179
|
$("#divGoogleTTSAudioConfig").hide();
|
|
180
180
|
$("#divElevenLabsOptions").show();
|
|
181
|
-
$("#divSSML").hide();
|
|
181
|
+
$("#divSSML").hide();
|
|
182
182
|
} else {
|
|
183
183
|
$("#divGoogleTTSAudioConfig").hide();
|
|
184
184
|
$("#divElevenLabsOptions").hide();
|
|
185
|
-
|
|
185
|
+
$("#divSSML").show();
|
|
186
186
|
}
|
|
187
187
|
} catch (error) {
|
|
188
188
|
}
|
|
@@ -537,7 +537,8 @@
|
|
|
537
537
|
| Enable SSML | Enable the SSML XML notation. Please be aware, not all the TTS engines supports that.|
|
|
538
538
|
| Rate | Only avaiable if you choose Google TTS Engine (with credentials). Specifies the speech speed (Between 0.25 and 4.0, default 1). |
|
|
539
539
|
| Pitch | Only avaiable if you choose Google TTS Engine (with credentials). Specifies the speech pitch (Between -20.0 and 20.0, default 0). |
|
|
540
|
-
| Hailing | Before the first TTS message of the message queues,
|
|
540
|
+
| Hailing | Before the first TTS message of the message queues, the node will play an "hailing" sound. You can select the hailing, upload your own, or totally disable it. |
|
|
541
|
+
| Upload hail | It allows you to upload your own hailing file. |
|
|
541
542
|
| Player | Select the player. If you select not to use a player, the node will output a msg with an array of files, ready to be played by third party nodes. In case you select No player, only output file name, you'll get a message with an additional property filesArray, containing an array of all mp3 files ready to be played with third party nodes. Please see below the OUTPUT MESSAGES FROM THE NODE section. |
|
|
542
543
|
| Volume | Set the preferred TTS volume, from "0" to "100" (can be overridden by passing msg.volume = "40"; to the node). |
|
|
543
544
|
| Unmute | Unmute the main and the addotional players, then restore the previous mute state once finished. (Can be overridden by passing msg.unmute = true; to the node). |
|
|
@@ -369,7 +369,7 @@ module.exports = function (RED) {
|
|
|
369
369
|
// 27/11/2019 Check Sonos connection health
|
|
370
370
|
|
|
371
371
|
node.CheckSonosConnection = () => {
|
|
372
|
-
if (node.playertype
|
|
372
|
+
if (node.playertype === "sonos") {
|
|
373
373
|
node.SonosClient.getCurrentState().then(state => {
|
|
374
374
|
|
|
375
375
|
// 11/12/202020 The connection with Sonos is OK.
|
|
@@ -392,7 +392,7 @@ module.exports = function (RED) {
|
|
|
392
392
|
node.oTimerSonosConnectionCheck = setTimeout(function () { node.CheckSonosConnection(); }, 10000);
|
|
393
393
|
});
|
|
394
394
|
} else {
|
|
395
|
-
node.setNodeStatus({ fill: "green", shape: "dot", text: "
|
|
395
|
+
node.setNodeStatus({ fill: "green", shape: "dot", text: "Ready." });
|
|
396
396
|
node.msg.connectionerror = false;
|
|
397
397
|
node.send([null, { payload: node.msg.connectionerror }]);
|
|
398
398
|
}
|
|
@@ -417,8 +417,6 @@ module.exports = function (RED) {
|
|
|
417
417
|
node.oAdditionalSonosPlayers.push({ oPlayer: new sonos.Sonos(element.host), hostVolumeAdjust: Number(element.hostVolumeAdjust) });
|
|
418
418
|
RED.log.info("ttsultimate: FOUND ADDITIONAL PLAYER " + element.host + " Adjusted volume: " + element.hostVolumeAdjust);
|
|
419
419
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
420
|
// 27/11/2019 Start the connection healty check
|
|
423
421
|
node.oTimerSonosConnectionCheck = setTimeout(function () { node.CheckSonosConnection(); }, 5000);
|
|
424
422
|
} else if (node.playertype === "noplayer") {
|
|
@@ -427,7 +425,6 @@ module.exports = function (RED) {
|
|
|
427
425
|
|
|
428
426
|
node.setNodeStatus({ fill: 'grey', shape: 'ring', text: 'Initialized.' });
|
|
429
427
|
|
|
430
|
-
|
|
431
428
|
// 22/09/2020 Flush Queue and set to stopped
|
|
432
429
|
node.flushQueue = () => {
|
|
433
430
|
// 10/04/2018 Remove the TTS message from the queue
|
|
@@ -439,8 +436,6 @@ module.exports = function (RED) {
|
|
|
439
436
|
if (node.server.whoIsUsingTheServer === node.id) node.server.whoIsUsingTheServer = "";
|
|
440
437
|
}
|
|
441
438
|
|
|
442
|
-
|
|
443
|
-
|
|
444
439
|
// 30/12/2020 Supergiovane resume queue for radio, queue music, TV in , line in etc.
|
|
445
440
|
async function resumeMusicQueue(_oTrack, _oPlayer = node.SonosClient) {
|
|
446
441
|
|
|
@@ -526,43 +521,46 @@ module.exports = function (RED) {
|
|
|
526
521
|
let t = setTimeout(() => { return true; }, 5000); // Wait some seconds
|
|
527
522
|
};
|
|
528
523
|
|
|
529
|
-
|
|
530
524
|
// Handle the queue
|
|
531
525
|
async function HandleQueue() {
|
|
532
526
|
node.bBusyPlayingQueue = true;
|
|
533
527
|
node.server.whoIsUsingTheServer = node.id; // Signal to other ttsultimate node, that i'm using the Sonos device
|
|
534
528
|
try {
|
|
535
529
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
530
|
+
if (node.playertype !== "noplayer") {
|
|
531
|
+
// Get the current music queue, if one
|
|
532
|
+
var oCurTrack = null;
|
|
533
|
+
try {
|
|
534
|
+
oCurTrack = await getMusicQueue();
|
|
535
|
+
// 19/04/2022 The current track of additional players is read in the groupSpeakerySync function
|
|
536
|
+
} catch (error) {
|
|
537
|
+
oCurTrack = null;
|
|
538
|
+
}
|
|
544
539
|
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
540
|
+
// 05/12/2020 Set "completed" to false and send it
|
|
541
|
+
node.msg.completed = false;
|
|
542
|
+
try {
|
|
543
|
+
await groupSpeakersSync(); // 20/03/2020 Group Speakers toghether and reads each current track
|
|
544
|
+
} catch (error) {
|
|
545
|
+
// Don't care.
|
|
546
|
+
node.setNodeStatus({ fill: "red", shape: "ring", text: "Error grouping speakers: " + error.message });
|
|
547
|
+
RED.log.error("ttsultimate: Error grouping speakers: " + error.message);
|
|
548
|
+
}
|
|
554
549
|
|
|
555
|
-
|
|
550
|
+
node.send([{ passThroughMessage: node.passThroughMessage, payload: node.msg.completed }, null]);
|
|
556
551
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
552
|
+
// 24/08/2021 If something was playing, stop the player https://github.com/Supergiovane/node-red-contrib-tts-ultimate/issues/32
|
|
553
|
+
try {
|
|
554
|
+
//await node.SonosClient.stop(); //.then(result => {
|
|
555
|
+
await STOPSync();
|
|
556
|
+
} catch (error) {
|
|
557
|
+
//RED.log.error("ttsultimate: Error stopping in HandleSend: " + error.message);
|
|
558
|
+
}
|
|
559
|
+
} else {
|
|
560
|
+
node.msg.completed = false;
|
|
561
|
+
node.send([{ passThroughMessage: node.passThroughMessage, payload: node.msg.completed }, null]);
|
|
563
562
|
}
|
|
564
563
|
|
|
565
|
-
|
|
566
564
|
while (node.tempMSGStorage.length > 0) {
|
|
567
565
|
node.currentMSGbeingSpoken = node.tempMSGStorage.shift()//node.tempMSGStorage[0];// Advise the whole node of the currently spoken MSG
|
|
568
566
|
const msg = node.currentMSGbeingSpoken.payload.toString(); // Get the text to be spoken
|
|
@@ -874,20 +872,19 @@ module.exports = function (RED) {
|
|
|
874
872
|
node.send([{ passThroughMessage: node.passThroughMessage, payload: node.msg.completed }, null]);
|
|
875
873
|
node.bBusyPlayingQueue = false
|
|
876
874
|
node.server.whoIsUsingTheServer = ""; // Signal to other ttsultimate node, that i'm not using the Sonos device anymore
|
|
877
|
-
},
|
|
875
|
+
}, 500)
|
|
878
876
|
|
|
879
877
|
} else if (node.playertype === "noplayer") {
|
|
880
878
|
// End task if no player is selected.
|
|
881
879
|
// Output the array of files
|
|
882
|
-
|
|
883
880
|
// Signal end playing
|
|
884
|
-
let t = setTimeout(() => {
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
}, 1000)
|
|
881
|
+
//let t = setTimeout(() => {
|
|
882
|
+
node.msg.completed = true;
|
|
883
|
+
node.currentMSGbeingSpoken = {};
|
|
884
|
+
node.send([{ passThroughMessage: node.passThroughMessage, payload: node.msg.completed, filesArray: noPlayerFileArray }, null]);
|
|
885
|
+
node.bBusyPlayingQueue = false
|
|
886
|
+
node.server.whoIsUsingTheServer = ""; // Signal to other ttsultimate node, that i'm not using the Sonos device anymore
|
|
887
|
+
//}, 1000)
|
|
891
888
|
}
|
|
892
889
|
|
|
893
890
|
} catch (error) {
|
|
@@ -1028,14 +1025,18 @@ module.exports = function (RED) {
|
|
|
1028
1025
|
// There is already a priority message being spoken, do nothing
|
|
1029
1026
|
node.setNodeStatus({ fill: 'grey', shape: 'ring', text: 'There is already a priority message being spoken...queuing' });
|
|
1030
1027
|
} else {
|
|
1031
|
-
node.
|
|
1032
|
-
node.
|
|
1028
|
+
if (node.playertype !== 'noplayer') {
|
|
1029
|
+
node.SonosClient.stop().then(result => {
|
|
1030
|
+
node.bTimeOutPlay = true;
|
|
1031
|
+
node.currentMSGbeingSpoken = msg; // Set immediately, otherwise if comes new flow messages, currentMSGbeingSpoken is too old.
|
|
1032
|
+
}).catch(err => {
|
|
1033
|
+
// Don't care
|
|
1034
|
+
node.bTimeOutPlay = true;
|
|
1035
|
+
node.currentMSGbeingSpoken = msg;// Set immediately, otherwise if comes new flow messages, currentMSGbeingSpoken is too old.
|
|
1036
|
+
})
|
|
1037
|
+
} else {
|
|
1033
1038
|
node.currentMSGbeingSpoken = msg; // Set immediately, otherwise if comes new flow messages, currentMSGbeingSpoken is too old.
|
|
1034
|
-
}
|
|
1035
|
-
// Don't care
|
|
1036
|
-
node.bTimeOutPlay = true;
|
|
1037
|
-
node.currentMSGbeingSpoken = msg;// Set immediately, otherwise if comes new flow messages, currentMSGbeingSpoken is too old.
|
|
1038
|
-
})
|
|
1039
|
+
}
|
|
1039
1040
|
}
|
|
1040
1041
|
|
|
1041
1042
|
} else {
|
|
@@ -1047,44 +1048,6 @@ module.exports = function (RED) {
|
|
|
1047
1048
|
}
|
|
1048
1049
|
// ########################
|
|
1049
1050
|
|
|
1050
|
-
// // 03/01/2022 if ssml is enabled, disable the auto split function
|
|
1051
|
-
// if (!node.ssml) {
|
|
1052
|
-
// // SSML disabled
|
|
1053
|
-
// // 30/01/2021 split the text if it's too long, otherwies i'll have issues with filename too long.
|
|
1054
|
-
// if (msg.payload.length >= node.server.limitTTSFilenameLenght) {
|
|
1055
|
-
// let sTemp = "";
|
|
1056
|
-
// let aSeps = [".", ",", ":", ";", "!", "?"];
|
|
1057
|
-
// let sPayload = msg.payload.replace(/[\r\n]+/gm, "");
|
|
1058
|
-
// for (let index = 0; index < sPayload.length; index++) {
|
|
1059
|
-
// const element = sPayload.substr(index, 1);
|
|
1060
|
-
// sTemp += element;
|
|
1061
|
-
// if (aSeps.indexOf(element) > -1 && sTemp.length > 20) {
|
|
1062
|
-
// const oMsg = RED.util.cloneMessage(msg);
|
|
1063
|
-
// oMsg.payload = sTemp;
|
|
1064
|
-
// node.tempMSGStorage.push(oMsg);
|
|
1065
|
-
// sTemp = "";
|
|
1066
|
-
// }
|
|
1067
|
-
// if (sTemp.length > node.server.limitTTSFilenameLenght && element === " ") {
|
|
1068
|
-
// // Split using space
|
|
1069
|
-
// const oMsg = RED.util.cloneMessage(msg);
|
|
1070
|
-
// oMsg.payload = sTemp;
|
|
1071
|
-
// node.tempMSGStorage.push(oMsg);
|
|
1072
|
-
// sTemp = "";
|
|
1073
|
-
// }
|
|
1074
|
-
// }
|
|
1075
|
-
// // Remaining
|
|
1076
|
-
// const oMsg = RED.util.cloneMessage(msg);
|
|
1077
|
-
// oMsg.payload = sTemp;
|
|
1078
|
-
// node.tempMSGStorage.push(oMsg);
|
|
1079
|
-
|
|
1080
|
-
// } else {
|
|
1081
|
-
// node.tempMSGStorage.push(msg);
|
|
1082
|
-
// }
|
|
1083
|
-
// } else {
|
|
1084
|
-
// // SSML enabled
|
|
1085
|
-
// node.tempMSGStorage.push(msg);
|
|
1086
|
-
// }
|
|
1087
|
-
|
|
1088
1051
|
// Starts main queue watching
|
|
1089
1052
|
node.tempMSGStorage.push(msg);
|
|
1090
1053
|
node.waitForQueue();
|
|
@@ -1107,7 +1070,8 @@ module.exports = function (RED) {
|
|
|
1107
1070
|
node.setNodeStatus({ fill: 'yellow', shape: 'ring', text: "Sonos is occupied by " + node.server.whoIsUsingTheServer + " Retry..." });
|
|
1108
1071
|
}
|
|
1109
1072
|
node.waitForQueue();
|
|
1110
|
-
}, 1000);
|
|
1073
|
+
}, node.playertype === "noplayer" ? 100 : 1000);
|
|
1074
|
+
|
|
1111
1075
|
}
|
|
1112
1076
|
|
|
1113
1077
|
node.on('close', function (done) {
|