@mulingai-npm/redis 2.1.0 → 2.1.2
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.
|
@@ -6,7 +6,8 @@ export type MulingstreamChunkData = {
|
|
|
6
6
|
chunkNumber: number;
|
|
7
7
|
language: string;
|
|
8
8
|
sttProviders: SttProvider[];
|
|
9
|
-
|
|
9
|
+
translationTargetLanguages: string[];
|
|
10
|
+
ttsTargetLanguages: string[];
|
|
10
11
|
finalTranscription: string;
|
|
11
12
|
sttStatus: StepStatus;
|
|
12
13
|
audioChunk: {
|
|
@@ -77,7 +78,8 @@ export declare class MulingstreamChunkManager {
|
|
|
77
78
|
isLast: boolean;
|
|
78
79
|
theme: string;
|
|
79
80
|
sttProviders: SttProvider[];
|
|
80
|
-
|
|
81
|
+
translationTargetLanguages: string[];
|
|
82
|
+
ttsTargetLanguages: string[];
|
|
81
83
|
}): Promise<void>;
|
|
82
84
|
/**
|
|
83
85
|
* Given roomId and chunkNumber, return the single chunk from the array
|
|
@@ -58,7 +58,7 @@ class MulingstreamChunkManager {
|
|
|
58
58
|
* Adds a new Mulingstream chunk to the array stored at [${roomId}].
|
|
59
59
|
*/
|
|
60
60
|
async addMulingstreamChunk(params) {
|
|
61
|
-
const { roomId, chunkNumber, language, start, end, duration, isFirst, isLast, theme, sttProviders,
|
|
61
|
+
const { roomId, chunkNumber, language, start, end, duration, isFirst, isLast, theme, sttProviders, translationTargetLanguages, ttsTargetLanguages } = params;
|
|
62
62
|
// ensure we only keep the last 5 elements
|
|
63
63
|
const currentLength = await this.redisClient.jsonArrLen(`[${roomId}]`, '.');
|
|
64
64
|
if ((currentLength !== null && currentLength !== void 0 ? currentLength : 0) >= ROOM_ARRAY_LENGTH) {
|
|
@@ -86,12 +86,14 @@ class MulingstreamChunkManager {
|
|
|
86
86
|
// Build translation and tts objects
|
|
87
87
|
const translation = {};
|
|
88
88
|
const tts = {};
|
|
89
|
-
for (const
|
|
90
|
-
translation[
|
|
89
|
+
for (const language of translationTargetLanguages) {
|
|
90
|
+
translation[language] = {
|
|
91
91
|
translation: '',
|
|
92
92
|
status: 'INIT'
|
|
93
93
|
};
|
|
94
|
-
|
|
94
|
+
}
|
|
95
|
+
for (const language of ttsTargetLanguages) {
|
|
96
|
+
tts[language] = {
|
|
95
97
|
ttsAudioPath: '',
|
|
96
98
|
status: 'INIT',
|
|
97
99
|
isEmitted: false
|
|
@@ -102,7 +104,8 @@ class MulingstreamChunkManager {
|
|
|
102
104
|
chunkNumber,
|
|
103
105
|
language,
|
|
104
106
|
sttProviders,
|
|
105
|
-
|
|
107
|
+
translationTargetLanguages,
|
|
108
|
+
ttsTargetLanguages,
|
|
106
109
|
finalTranscription: '',
|
|
107
110
|
sttStatus: 'INIT',
|
|
108
111
|
audioChunk,
|
package/package.json
CHANGED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { RedisClient } from '../redis-client';
|
|
2
|
-
export type SttProvider = 'azure' | 'whisper' | 'google' | 'aws';
|
|
3
|
-
export type MulingstreamRoomData = {
|
|
4
|
-
mulingstreamRoomTrackerId: string;
|
|
5
|
-
roomId: string;
|
|
6
|
-
sttProviders: SttProvider[];
|
|
7
|
-
targetLanguages: string[];
|
|
8
|
-
lastReadyChunk: number;
|
|
9
|
-
lastUsedChunk: number;
|
|
10
|
-
lastDiscardedChunk: number;
|
|
11
|
-
lastReadyTranscription: number;
|
|
12
|
-
lastUsedTranscription: number;
|
|
13
|
-
lastDiscardedTranscription: number;
|
|
14
|
-
stt: {
|
|
15
|
-
[sttProvider: string]: {
|
|
16
|
-
lastReadyStt: number;
|
|
17
|
-
lastUsedStt: number;
|
|
18
|
-
lastDiscardedStt: number;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
translation: {
|
|
22
|
-
[language: string]: {
|
|
23
|
-
lastReadyTranslation: number;
|
|
24
|
-
lastUsedTranslation: number;
|
|
25
|
-
lastDiscardedTranslation: number;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
tts: {
|
|
29
|
-
[language: string]: {
|
|
30
|
-
lastReadyTts: number;
|
|
31
|
-
lastUsedTts: number;
|
|
32
|
-
lastDiscardedTts: number;
|
|
33
|
-
lastEmittedTts: number;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
export declare class MulingstreamRoomTracker {
|
|
38
|
-
private redisClient;
|
|
39
|
-
constructor(redisClient: RedisClient);
|
|
40
|
-
private parseHashData;
|
|
41
|
-
/**
|
|
42
|
-
* Initializes a new MulingstreamRoomTracker for a given room.
|
|
43
|
-
* - The ID is `[roomId]`.
|
|
44
|
-
* - All "lastReady", "lastUsed", "lastDiscarded", etc. are set to -1 initially.
|
|
45
|
-
* - The sttProviders array is used to create stt sub-objects.
|
|
46
|
-
* - The targetLanguages array is used to create translation/tts sub-objects.
|
|
47
|
-
*/
|
|
48
|
-
initMulingstreamRoomTracker(params: {
|
|
49
|
-
roomId: string;
|
|
50
|
-
sttProviders: SttProvider[];
|
|
51
|
-
targetLanguages: string[];
|
|
52
|
-
}): Promise<string>;
|
|
53
|
-
/**
|
|
54
|
-
* Retrieves all MulingstreamRoomTrackers by scanning keys `mulingstreamRoomTracker:*`.
|
|
55
|
-
*/
|
|
56
|
-
getMulingstreamRoomTrackers(): Promise<MulingstreamRoomData[]>;
|
|
57
|
-
/**
|
|
58
|
-
* Retrieves a single MulingstreamRoomTracker by roomId.
|
|
59
|
-
*/
|
|
60
|
-
getMulingstreamRoomTracker(roomId: string): Promise<MulingstreamRoomData | null>;
|
|
61
|
-
/**
|
|
62
|
-
* Updates the chunk-level tracker fields (lastReadyChunk, lastUsedChunk, lastDiscardedChunk).
|
|
63
|
-
* Any argument passed as null means "do not update that field."
|
|
64
|
-
*/
|
|
65
|
-
updateChunkTracker(roomId: string, lastReadyChunk: number | null, lastUsedChunk: number | null, lastDiscardedChunk: number | null): Promise<boolean>;
|
|
66
|
-
/**
|
|
67
|
-
* Updates the transcription tracker fields (lastReadyTranscription, lastUsedTranscription , lastDiscardedTranscription).
|
|
68
|
-
* Any argument passed as null means "do not update that field."
|
|
69
|
-
*/
|
|
70
|
-
updateTranscriptionTracker(roomId: string, lastReadyTranscription: number | null, lastUsedTranscription: number | null, lastDiscardedTranscription: number | null): Promise<boolean>;
|
|
71
|
-
/**
|
|
72
|
-
* Updates the stt tracker for a specific STT provider in the room.
|
|
73
|
-
* If any argument is null, we do not update that field.
|
|
74
|
-
*/
|
|
75
|
-
updateSttTracker(roomId: string, sttProvider: SttProvider, lastReadyStt: number | null, lastUsedStt: number | null, lastDiscardedStt: number | null): Promise<boolean>;
|
|
76
|
-
/**
|
|
77
|
-
* Updates the translation tracker for a specific language in the room.
|
|
78
|
-
* If any argument is null, we do not update that field.
|
|
79
|
-
*/
|
|
80
|
-
updateTranslationTracker(roomId: string, language: string, lastReadyTranslation: number | null, lastUsedTranslation: number | null, lastDiscardedTranslation: number | null): Promise<boolean>;
|
|
81
|
-
/**
|
|
82
|
-
* Updates the TTS tracker for a specific language in the room.
|
|
83
|
-
* If any argument is null, we do not update that field.
|
|
84
|
-
*/
|
|
85
|
-
updateTtsTracker(roomId: string, language: string, lastReadyTts: number | null, lastUsedTts: number | null, lastDiscardedTts: number | null, lastEmittedTts: number | null): Promise<boolean>;
|
|
86
|
-
}
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MulingstreamRoomTracker = void 0;
|
|
4
|
-
const EXPIRATION = 48 * 60 * 60; // 48 hours in seconds
|
|
5
|
-
class MulingstreamRoomTracker {
|
|
6
|
-
constructor(redisClient) {
|
|
7
|
-
this.redisClient = redisClient;
|
|
8
|
-
}
|
|
9
|
-
parseHashData(data) {
|
|
10
|
-
// Parse any JSON fields
|
|
11
|
-
const sttProviders = JSON.parse(data.sttProviders);
|
|
12
|
-
const targetLanguages = JSON.parse(data.targetLanguages);
|
|
13
|
-
const stt = JSON.parse(data.stt);
|
|
14
|
-
const translation = JSON.parse(data.translation);
|
|
15
|
-
const tts = JSON.parse(data.tts);
|
|
16
|
-
return {
|
|
17
|
-
mulingstreamRoomTrackerId: data.mulingstreamRoomTrackerId,
|
|
18
|
-
roomId: data.roomId,
|
|
19
|
-
sttProviders,
|
|
20
|
-
targetLanguages,
|
|
21
|
-
lastReadyChunk: parseInt(data.lastReadyChunk, 10),
|
|
22
|
-
lastUsedChunk: parseInt(data.lastUsedChunk, 10),
|
|
23
|
-
lastDiscardedChunk: parseInt(data.lastDiscardedChunk, 10),
|
|
24
|
-
lastReadyTranscription: parseInt(data.lastReadyTranscription, 10),
|
|
25
|
-
lastUsedTranscription: parseInt(data.lastUsedTranscription, 10),
|
|
26
|
-
lastDiscardedTranscription: parseInt(data.lastDiscardedTranscription, 10),
|
|
27
|
-
stt,
|
|
28
|
-
translation,
|
|
29
|
-
tts
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Initializes a new MulingstreamRoomTracker for a given room.
|
|
34
|
-
* - The ID is `[roomId]`.
|
|
35
|
-
* - All "lastReady", "lastUsed", "lastDiscarded", etc. are set to -1 initially.
|
|
36
|
-
* - The sttProviders array is used to create stt sub-objects.
|
|
37
|
-
* - The targetLanguages array is used to create translation/tts sub-objects.
|
|
38
|
-
*/
|
|
39
|
-
async initMulingstreamRoomTracker(params) {
|
|
40
|
-
const { roomId, sttProviders, targetLanguages } = params;
|
|
41
|
-
// We'll use [roomId] as the unique ID
|
|
42
|
-
const mulingstreamRoomTrackerId = `[${roomId}]`;
|
|
43
|
-
// Build stt object
|
|
44
|
-
// For each provider, set lastReadyStt = -1, lastUsedStt = -1, lastDiscardedStt = -1
|
|
45
|
-
const stt = {};
|
|
46
|
-
for (const provider of sttProviders) {
|
|
47
|
-
stt[provider] = {
|
|
48
|
-
lastReadyStt: -1,
|
|
49
|
-
lastUsedStt: -1,
|
|
50
|
-
lastDiscardedStt: -1
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
// Build translation object
|
|
54
|
-
// For each target language, set lastReadyTranslation = -1, lastUsedTranslation = -1, lastDiscardedTranslation = -1
|
|
55
|
-
const translation = {};
|
|
56
|
-
for (const lang of targetLanguages) {
|
|
57
|
-
translation[lang] = {
|
|
58
|
-
lastReadyTranslation: -1,
|
|
59
|
-
lastUsedTranslation: -1,
|
|
60
|
-
lastDiscardedTranslation: -1
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
// Build tts object
|
|
64
|
-
// For each target language, set lastReadyTts = -1, lastUsedTts = -1, lastDiscardedTts = -1, lastEmittedTts = -1
|
|
65
|
-
const tts = {};
|
|
66
|
-
for (const lang of targetLanguages) {
|
|
67
|
-
tts[lang] = {
|
|
68
|
-
lastReadyTts: -1,
|
|
69
|
-
lastUsedTts: -1,
|
|
70
|
-
lastDiscardedTts: -1,
|
|
71
|
-
lastEmittedTts: -1
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
// Root-level chunk trackers
|
|
75
|
-
const lastReadyChunk = -1;
|
|
76
|
-
const lastUsedChunk = -1;
|
|
77
|
-
const lastDiscardedChunk = -1;
|
|
78
|
-
const lastReadyTranscription = -1;
|
|
79
|
-
const lastUsedTranscription = -1;
|
|
80
|
-
const lastDiscardedTranscription = -1;
|
|
81
|
-
// Store everything in Redis
|
|
82
|
-
await this.redisClient.hset(`mulingstreamRoomTracker:${mulingstreamRoomTrackerId}`, {
|
|
83
|
-
mulingstreamRoomTrackerId,
|
|
84
|
-
roomId,
|
|
85
|
-
sttProviders: JSON.stringify(sttProviders),
|
|
86
|
-
targetLanguages: JSON.stringify(targetLanguages),
|
|
87
|
-
lastReadyChunk: lastReadyChunk.toString(),
|
|
88
|
-
lastUsedChunk: lastUsedChunk.toString(),
|
|
89
|
-
lastDiscardedChunk: lastDiscardedChunk.toString(),
|
|
90
|
-
lastReadyTranscription: lastReadyTranscription.toString(),
|
|
91
|
-
lastUsedTranscription: lastUsedTranscription.toString(),
|
|
92
|
-
lastDiscardedTranscription: lastDiscardedTranscription.toString(),
|
|
93
|
-
stt: JSON.stringify(stt),
|
|
94
|
-
translation: JSON.stringify(translation),
|
|
95
|
-
tts: JSON.stringify(tts)
|
|
96
|
-
});
|
|
97
|
-
// set expiration
|
|
98
|
-
await this.redisClient.expire(`mulingstreamRoomTracker:${mulingstreamRoomTrackerId}`, EXPIRATION);
|
|
99
|
-
return mulingstreamRoomTrackerId;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Retrieves all MulingstreamRoomTrackers by scanning keys `mulingstreamRoomTracker:*`.
|
|
103
|
-
*/
|
|
104
|
-
async getMulingstreamRoomTrackers() {
|
|
105
|
-
const pattern = 'mulingstreamRoomTracker:*';
|
|
106
|
-
const keys = await this.redisClient.keys(pattern);
|
|
107
|
-
if (!keys || keys.length === 0) {
|
|
108
|
-
return [];
|
|
109
|
-
}
|
|
110
|
-
const results = [];
|
|
111
|
-
for (const key of keys) {
|
|
112
|
-
const data = await this.redisClient.hgetall(key);
|
|
113
|
-
if (data && data.mulingstreamRoomTrackerId) {
|
|
114
|
-
results.push(this.parseHashData(data));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return results;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Retrieves a single MulingstreamRoomTracker by roomId.
|
|
121
|
-
*/
|
|
122
|
-
async getMulingstreamRoomTracker(roomId) {
|
|
123
|
-
const mulingstreamRoomTrackerId = `[${roomId}]`;
|
|
124
|
-
const data = await this.redisClient.hgetall(`mulingstreamRoomTracker:${mulingstreamRoomTrackerId}`);
|
|
125
|
-
if (!data || !data.mulingstreamRoomTrackerId) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
return this.parseHashData(data);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Updates the chunk-level tracker fields (lastReadyChunk, lastUsedChunk, lastDiscardedChunk).
|
|
132
|
-
* Any argument passed as null means "do not update that field."
|
|
133
|
-
*/
|
|
134
|
-
async updateChunkTracker(roomId, lastReadyChunk, lastUsedChunk, lastDiscardedChunk) {
|
|
135
|
-
const mulingstreamRoomTrackerId = `[${roomId}]`;
|
|
136
|
-
const data = await this.redisClient.hgetall(`mulingstreamRoomTracker:${mulingstreamRoomTrackerId}`);
|
|
137
|
-
if (!data || !data.mulingstreamRoomTrackerId) {
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
const updates = {};
|
|
141
|
-
if (lastReadyChunk !== null) {
|
|
142
|
-
updates.lastReadyChunk = lastReadyChunk.toString();
|
|
143
|
-
}
|
|
144
|
-
if (lastUsedChunk !== null) {
|
|
145
|
-
updates.lastUsedChunk = lastUsedChunk.toString();
|
|
146
|
-
}
|
|
147
|
-
if (lastDiscardedChunk !== null) {
|
|
148
|
-
updates.lastDiscardedChunk = lastDiscardedChunk.toString();
|
|
149
|
-
}
|
|
150
|
-
if (Object.keys(updates).length > 0) {
|
|
151
|
-
await this.redisClient.hset(`mulingstreamRoomTracker:${mulingstreamRoomTrackerId}`, updates);
|
|
152
|
-
}
|
|
153
|
-
return true;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Updates the transcription tracker fields (lastReadyTranscription, lastUsedTranscription , lastDiscardedTranscription).
|
|
157
|
-
* Any argument passed as null means "do not update that field."
|
|
158
|
-
*/
|
|
159
|
-
async updateTranscriptionTracker(roomId, lastReadyTranscription, lastUsedTranscription, lastDiscardedTranscription) {
|
|
160
|
-
const mulingstreamRoomTrackerId = `[${roomId}]`;
|
|
161
|
-
const data = await this.redisClient.hgetall(`mulingstreamRoomTracker:${mulingstreamRoomTrackerId}`);
|
|
162
|
-
if (!data || !data.mulingstreamRoomTrackerId) {
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
const updates = {};
|
|
166
|
-
if (lastReadyTranscription !== null) {
|
|
167
|
-
updates.lastReadyTranscription = lastReadyTranscription.toString();
|
|
168
|
-
}
|
|
169
|
-
if (lastUsedTranscription !== null) {
|
|
170
|
-
updates.lastUsedTranscription = lastUsedTranscription.toString();
|
|
171
|
-
}
|
|
172
|
-
if (lastDiscardedTranscription !== null) {
|
|
173
|
-
updates.lastDiscardedTranscription = lastDiscardedTranscription.toString();
|
|
174
|
-
}
|
|
175
|
-
if (Object.keys(updates).length > 0) {
|
|
176
|
-
await this.redisClient.hset(`mulingstreamRoomTracker:${mulingstreamRoomTrackerId}`, updates);
|
|
177
|
-
}
|
|
178
|
-
return true;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Updates the stt tracker for a specific STT provider in the room.
|
|
182
|
-
* If any argument is null, we do not update that field.
|
|
183
|
-
*/
|
|
184
|
-
async updateSttTracker(roomId, sttProvider, lastReadyStt, lastUsedStt, lastDiscardedStt) {
|
|
185
|
-
const mulingstreamRoomTrackerId = `[${roomId}]`;
|
|
186
|
-
const data = await this.redisClient.hgetall(`mulingstreamRoomTracker:${mulingstreamRoomTrackerId}`);
|
|
187
|
-
if (!data || !data.mulingstreamRoomTrackerId) {
|
|
188
|
-
return false;
|
|
189
|
-
}
|
|
190
|
-
const stt = JSON.parse(data.stt);
|
|
191
|
-
if (!stt[sttProvider]) {
|
|
192
|
-
return false; // The provider doesn't exist in this room
|
|
193
|
-
}
|
|
194
|
-
if (lastReadyStt !== null) {
|
|
195
|
-
stt[sttProvider].lastReadyStt = lastReadyStt;
|
|
196
|
-
}
|
|
197
|
-
if (lastUsedStt !== null) {
|
|
198
|
-
stt[sttProvider].lastUsedStt = lastUsedStt;
|
|
199
|
-
}
|
|
200
|
-
if (lastDiscardedStt !== null) {
|
|
201
|
-
stt[sttProvider].lastDiscardedStt = lastDiscardedStt;
|
|
202
|
-
}
|
|
203
|
-
await this.redisClient.hset(`mulingstreamRoomTracker:${mulingstreamRoomTrackerId}`, {
|
|
204
|
-
stt: JSON.stringify(stt)
|
|
205
|
-
});
|
|
206
|
-
return true;
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Updates the translation tracker for a specific language in the room.
|
|
210
|
-
* If any argument is null, we do not update that field.
|
|
211
|
-
*/
|
|
212
|
-
async updateTranslationTracker(roomId, language, lastReadyTranslation, lastUsedTranslation, lastDiscardedTranslation) {
|
|
213
|
-
const mulingstreamRoomTrackerId = `[${roomId}]`;
|
|
214
|
-
const data = await this.redisClient.hgetall(`mulingstreamRoomTracker:${mulingstreamRoomTrackerId}`);
|
|
215
|
-
if (!data || !data.mulingstreamRoomTrackerId) {
|
|
216
|
-
return false;
|
|
217
|
-
}
|
|
218
|
-
const translation = JSON.parse(data.translation);
|
|
219
|
-
if (!translation[language]) {
|
|
220
|
-
return false; // The language isn't tracked in this room
|
|
221
|
-
}
|
|
222
|
-
if (lastReadyTranslation !== null) {
|
|
223
|
-
translation[language].lastReadyTranslation = lastReadyTranslation;
|
|
224
|
-
}
|
|
225
|
-
if (lastUsedTranslation !== null) {
|
|
226
|
-
translation[language].lastUsedTranslation = lastUsedTranslation;
|
|
227
|
-
}
|
|
228
|
-
if (lastDiscardedTranslation !== null) {
|
|
229
|
-
translation[language].lastDiscardedTranslation = lastDiscardedTranslation;
|
|
230
|
-
}
|
|
231
|
-
await this.redisClient.hset(`mulingstreamRoomTracker:${mulingstreamRoomTrackerId}`, {
|
|
232
|
-
translation: JSON.stringify(translation)
|
|
233
|
-
});
|
|
234
|
-
return true;
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Updates the TTS tracker for a specific language in the room.
|
|
238
|
-
* If any argument is null, we do not update that field.
|
|
239
|
-
*/
|
|
240
|
-
async updateTtsTracker(roomId, language, lastReadyTts, lastUsedTts, lastDiscardedTts, lastEmittedTts) {
|
|
241
|
-
const mulingstreamRoomTrackerId = `[${roomId}]`;
|
|
242
|
-
const data = await this.redisClient.hgetall(`mulingstreamRoomTracker:${mulingstreamRoomTrackerId}`);
|
|
243
|
-
if (!data || !data.mulingstreamRoomTrackerId) {
|
|
244
|
-
return false;
|
|
245
|
-
}
|
|
246
|
-
const tts = JSON.parse(data.tts);
|
|
247
|
-
if (!tts[language]) {
|
|
248
|
-
return false; // The language isn't tracked in this room
|
|
249
|
-
}
|
|
250
|
-
if (lastReadyTts !== null) {
|
|
251
|
-
tts[language].lastReadyTts = lastReadyTts;
|
|
252
|
-
}
|
|
253
|
-
if (lastUsedTts !== null) {
|
|
254
|
-
tts[language].lastUsedTts = lastUsedTts;
|
|
255
|
-
}
|
|
256
|
-
if (lastDiscardedTts !== null) {
|
|
257
|
-
tts[language].lastDiscardedTts = lastDiscardedTts;
|
|
258
|
-
}
|
|
259
|
-
if (lastEmittedTts !== null) {
|
|
260
|
-
tts[language].lastEmittedTts = lastEmittedTts;
|
|
261
|
-
}
|
|
262
|
-
await this.redisClient.hset(`mulingstreamRoomTracker:${mulingstreamRoomTrackerId}`, {
|
|
263
|
-
tts: JSON.stringify(tts)
|
|
264
|
-
});
|
|
265
|
-
return true;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
exports.MulingstreamRoomTracker = MulingstreamRoomTracker;
|