node-red-contrib-tts-ultimate 3.0.0 → 3.0.1

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
@@ -5,8 +5,9 @@
5
5
  ## BREAKING CHANGE ! BREAKING CHANGE ! BREAKING CHANGE ! BREAKING CHANGE !
6
6
 
7
7
  <p>
8
- <b>Version 3.0.0</b> April 2025<br/>
8
+ <b>Version 3.0.0</b> June 2025<br/>
9
9
  - BREAKING CHANGE: Amazon Polly and Microsoft Azure TTS have been removed due to lack of time to update the old and complex API's. Anyone can add these again by forking the project and do a PR. Thank you!. If you still need those TTS, please stay or revert to 2.0.10.<br/>
10
+ - NEW: Added option to avoid resuming music if it was playing before TTS messages.<br/>
10
11
  </p>
11
12
 
12
13
  -----------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-tts-ultimate",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
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": {
@@ -79,7 +79,10 @@
79
79
  <label for="node-input-unmuteIfMuted"><i class="fa fa-bell-slash-o"></i> Unmute</label>
80
80
  <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>
81
81
  </div>
82
-
82
+ <div class="form-row">
83
+ <label for="node-input-doNotResumeMusic"><i class="fa fa-bell-slash-o"></i> Resume</label>
84
+ <input type="checkbox" id="node-input-doNotResumeMusic" style="margin-left: 0px; vertical-align: top; width: auto !important;"> <label style="width:auto !important;"> Do not resume previous music.</label>
85
+ </div>
83
86
  <div class="form-row">
84
87
  <label for="node-input-sonosipaddress"><i class="fa fa-globe"></i> Main Sonos Player</label>
85
88
  <label style="width:200px;" id="node-input-sonosipaddress">Discovering.... wait...</label>
@@ -136,6 +139,12 @@
136
139
  value: "Hailing_Hailing.mp3",
137
140
  required: false,
138
141
  },
142
+ doNotResumeMusic:
143
+ {
144
+ value: true,
145
+ required: false,
146
+ },
147
+
139
148
  config:
140
149
  {
141
150
  type: "ttsultimate-config",
@@ -549,6 +558,7 @@
549
558
  | 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. |
550
559
  | Volume | Set the preferred TTS volume, from "0" to "100" (can be overridden by passing msg.volume = "40"; to the node). |
551
560
  | 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). |
561
+ | Resume | If music was playing prior to TTS messages, the node will try to resume it, but can fail in some cases. Enabla this option to avoid resuming music after TTS message. |
552
562
  | Main Sonos Player | 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). It's possibile to group players, so your announcement can be played on all selected players. For this to happen, you need to select your primary coordinator player. All other players will be then controlled by this coordinator. |
553
563
  | Additional Players | Here you can add all additional players that will be grouped toghether to the Main Sonos Player coordinator group. You can add a player using the "ADD" button, below the list. For each additional player, you can adjust their volume, based on the Main Sonos Player volume -+100. |
554
564
 
@@ -80,7 +80,7 @@ module.exports = function (RED) {
80
80
  node.sonosCoordinatorIsPreviouslyMuted = false;
81
81
  node.passThroughMessage = {};
82
82
  node.bTimeOutPlay = false;
83
-
83
+ node.doNotResumeMusic = config.doNotResumeMusic === undefined ? false : config.doNotResumeMusic; // 06/2025 Do not resume previous music after TTS, if playing.
84
84
  if (typeof node.server !== "undefined" && node.server !== null) {
85
85
  node.sNoderedURL = node.server.sNoderedURL || "";
86
86
  }
@@ -857,37 +857,39 @@ module.exports = function (RED) {
857
857
  await delay(2000);
858
858
 
859
859
  // Resume music
860
- try {
861
- if (oCurTrack !== null && (!oCurTrack.hasOwnProperty("title") || oCurTrack.title.indexOf(".mp3") === -1)) {
862
- node.setNodeStatus({ fill: 'grey', shape: 'ring', text: "Resuming original queue..." });
863
- await resumeMusicQueue(oCurTrack);
864
- node.setNodeStatus({ fill: 'green', shape: 'ring', text: "Done resuming queue." });
865
- } else {
866
- // 28/08/2021 There was no queue playing. Delete the TTS from the queue
867
- node.setNodeStatus({ fill: 'green', shape: 'ring', text: "No queue to resume." });
860
+ if (!node.doNotResumeMusic) {
861
+ try {
862
+ if (oCurTrack !== null && (!oCurTrack.hasOwnProperty("title") || oCurTrack.title.indexOf(".mp3") === -1)) {
863
+ node.setNodeStatus({ fill: 'grey', shape: 'ring', text: "Resuming original queue..." });
864
+ await resumeMusicQueue(oCurTrack);
865
+ node.setNodeStatus({ fill: 'green', shape: 'ring', text: "Done resuming queue." });
866
+ } else {
867
+ // 28/08/2021 There was no queue playing. Delete the TTS from the queue
868
+ node.setNodeStatus({ fill: 'green', shape: 'ring', text: "No queue to resume." });
869
+ }
870
+ } catch (error) {
871
+ node.setNodeStatus({ fill: 'red', shape: 'ring', text: "Error resuming queue: " + error.message });
868
872
  }
869
- } catch (error) {
870
- node.setNodeStatus({ fill: 'red', shape: 'ring', text: "Error resuming queue: " + error.message });
871
873
  }
872
874
 
873
-
874
875
  // 19/04/2022 Resume music queue of additional players
875
- for (let index = 0; index < node.oAdditionalSonosPlayers.length; index++) {
876
- let addPlayer = node.oAdditionalSonosPlayers[index].oPlayer;
877
- let trackAddPlayer = addPlayer.additionalPlayerCurrentTrack;
878
- if (trackAddPlayer !== null) {
879
- try {
880
- await resumeMusicQueue(trackAddPlayer, addPlayer);
881
- node.setNodeStatus({ fill: 'green', shape: 'ring', text: "Done resuming queue additional player " + addPlayer.host || "" });
882
- } catch (error) {
883
- // Dont care
884
- RED.log.warn("ttsultimate: Error resuming music queue of additional player " + error.message + " " + addPlayer.host || "");
876
+ if (!node.doNotResumeMusic) {
877
+ for (let index = 0; index < node.oAdditionalSonosPlayers.length; index++) {
878
+ let addPlayer = node.oAdditionalSonosPlayers[index].oPlayer;
879
+ let trackAddPlayer = addPlayer.additionalPlayerCurrentTrack;
880
+ if (trackAddPlayer !== null) {
881
+ try {
882
+ await resumeMusicQueue(trackAddPlayer, addPlayer);
883
+ node.setNodeStatus({ fill: 'green', shape: 'ring', text: "Done resuming queue additional player " + addPlayer.host || "" });
884
+ } catch (error) {
885
+ // Dont care
886
+ RED.log.warn("ttsultimate: Error resuming music queue of additional player " + error.message + " " + addPlayer.host || "");
887
+ }
888
+ } else {
889
+ node.setNodeStatus({ fill: 'green', shape: 'ring', text: "No queue to resume for " + addPlayer.host || "" });
885
890
  }
886
- } else {
887
- node.setNodeStatus({ fill: 'green', shape: 'ring', text: "No queue to resume for " + addPlayer.host || "" });
888
891
  }
889
892
  }
890
-
891
893
  // Signal end playing
892
894
  let t = setTimeout(() => {
893
895
  node.msg.completed = true;