code cleanup
This commit is contained in:
parent
d9c9101965
commit
d5de27ca8b
11 changed files with 3 additions and 82 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -100,4 +100,5 @@ language_detection_model/*
|
|||
!language_detection_model/Where to get language detection model.txt
|
||||
.vscode/
|
||||
package-lock.json
|
||||
src/backend/loquendoBot_backend.exe
|
||||
src/backend/loquendoBot_backend.exe
|
||||
src/sounds/tts/*
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -21,22 +21,13 @@
|
|||
"axios": "^1.4.0",
|
||||
"electron-squirrel-startup": "^1.0.0",
|
||||
"express": "^4.18.2",
|
||||
"franc": "^6.1.0",
|
||||
"i18next-electron-language-detector": "^0.0.10",
|
||||
"iconv-lite": "^0.6.3",
|
||||
"ini": "^2.0.0",
|
||||
"kill-port": "^2.0.1",
|
||||
"langdetect": "^0.2.1",
|
||||
"node-google-tts-api": "^1.1.1",
|
||||
"querystring": "^0.2.1",
|
||||
"request": "^2.88.2",
|
||||
"say": "^0.16.0",
|
||||
"socket.io": "^4.7.1",
|
||||
"socket.io-client": "^4.7.1",
|
||||
"sound-play": "^1.1.0",
|
||||
"tmi.js": "^1.8.5",
|
||||
"url": "^0.11.1",
|
||||
"voice-recognition": "^1.0.6",
|
||||
"winston": "^3.10.0",
|
||||
"write-ini-file": "^4.0.1"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@ const createBackendServer = () =>
|
|||
python = spawn(path.join(pythonPath, './loquendoBot_backend.exe'), [settingsPath, 'prod']);
|
||||
} else {
|
||||
python = spawn('python', ['-u', path.join(pythonPath, './loquendoBot_backend.py'), settingsPath, 'dev']);
|
||||
// python = spawn(path.join(pythonPath, './loquendoBot_backend.exe'), [settingsPath, 'dev']);
|
||||
}
|
||||
// Capture the stdout of the Python process
|
||||
python.stdout.on('data', (data) => {
|
||||
|
|
@ -140,7 +139,6 @@ async function initiateBackend() {
|
|||
} catch (error) {
|
||||
console.error('Error during backend initialization:', error);
|
||||
}
|
||||
// setTimeout(getSTT, 3000);
|
||||
}
|
||||
|
||||
initiateBackend();
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@ const displayPanel = (panelSelectorClass, panelSelectorID, btnSelectorID) => {
|
|||
el.classList.remove('show');
|
||||
});
|
||||
if (panel.classList.contains('show')) {
|
||||
// panel.classList.remove('show');
|
||||
} else {
|
||||
panel.classList.add('show');
|
||||
}
|
||||
|
|
@ -103,7 +102,6 @@ displayPanel('.OptionPanel', '#BrowsersourceVtuber', '#btnBrowsersourceVtuber');
|
|||
displayPanel('.OptionPanel', '#Chat', '#btnChat');
|
||||
displayPanel('.OptionPanel', '#ThemeCreator', '#btnThemeCreator');
|
||||
displayPanel('.OptionPanel', '#ChatCreator', '#btnChatCreator');
|
||||
// displayPanel('.OptionPanel', '#Info', '#btnInfo');
|
||||
// #endregion
|
||||
|
||||
const displayPanelX = (panelSelectorClass, panelSelectorID, btnSelectorID) => {
|
||||
|
|
@ -120,7 +118,6 @@ const displayPanelX = (panelSelectorClass, panelSelectorID, btnSelectorID) => {
|
|||
el.classList.remove('item-active');
|
||||
});
|
||||
if (panel.classList.contains('item-active')) {
|
||||
// panel.classList.remove('item-active');
|
||||
} else {
|
||||
panel.classList.add('item-active');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,8 +73,6 @@ fetch(path.join(__dirname, '../logs/activity.log'))
|
|||
tableBody.appendChild(row);
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
// console.error('Error fetching log file:', error);
|
||||
});
|
||||
.catch((error) => {});
|
||||
|
||||
module.exports = logger;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ const path = require('path'); // get directory path
|
|||
|
||||
const { ipcRenderer, shell } = require('electron'); // necessary electron libraries to send data to the app
|
||||
const say = require('say');
|
||||
const request = require('request');
|
||||
const langdetect = require('langdetect');
|
||||
const io = require('socket.io-client');
|
||||
|
||||
const util = require('util');
|
||||
|
|
@ -15,7 +13,6 @@ const GoogleTTS = require('node-google-tts-api');
|
|||
|
||||
const tts = new GoogleTTS();
|
||||
const { Socket } = require('socket.io-client');
|
||||
// const { languages } = require('./languages');
|
||||
|
||||
const main = ipcRenderer.sendSync('environment');
|
||||
|
||||
|
|
@ -46,7 +43,6 @@ const messageTemplates = require(path.join(__dirname, './js/messageTemplates'));
|
|||
const languageObject = require(path.join(__dirname, './js/languages'));
|
||||
const logger = require(path.join(__dirname, './js/logger'));
|
||||
const sound = require(path.join(__dirname, './js/sound'));
|
||||
const talk = require(path.join(__dirname, './js/voiceQueue')); // Voice queue system
|
||||
const config = require(path.join(__dirname, './js/settings'));
|
||||
|
||||
const mediaDevices = require(path.join(__dirname, './js/mediaDevices'));
|
||||
|
|
@ -77,7 +73,6 @@ config.getGeneralSettings();
|
|||
const TTSVolume = 1;
|
||||
|
||||
const notificationSoundVolume = 1;
|
||||
// const slider = document.body.querySelector('#slider');
|
||||
const StartDateAndTime = Date.now();
|
||||
const speakButton = document.querySelector('#speakBtn');
|
||||
|
||||
|
|
@ -124,7 +119,6 @@ fs.readdir(sttModels, (err, files) => {
|
|||
|
||||
async function getAudioDevices() {
|
||||
if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {
|
||||
// logger.info('enumerateDevices() not supported.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -149,8 +143,6 @@ function setLanguagesinSelect(languageSelector, setting) {
|
|||
for (const language in languageObject.languages) {
|
||||
if (languageObject.languages.hasOwnProperty(language)) {
|
||||
const iso639 = languageObject.languages[language]['ISO-639'];
|
||||
// console.log(`${language}: ${iso639}`);
|
||||
|
||||
const option = document.createElement('option');
|
||||
option.value = iso639;
|
||||
option.innerHTML = `${iso639} - ${language}`;
|
||||
|
|
@ -207,11 +199,8 @@ function showChatMessage(article) {
|
|||
const usernameHtml = article.querySelector('.username');
|
||||
var style = getComputedStyle(usernameHtml);
|
||||
var style2 = getComputedStyle(usernameHtml);
|
||||
// console.log(style.getPropertyValue('width'));
|
||||
// console.log(style.getPropertyValue('width') + style.getPropertyValue('width') + 10);
|
||||
|
||||
const msg = article.querySelector('.msg-box');
|
||||
// msg.width = `${getComputedStyle(usernameHtml).width + getComputedStyle(usernameHtml).width / 10}px`;
|
||||
|
||||
const messages = Array.from(document.body.querySelectorAll('.msg-container'));
|
||||
const lastMessage = messages[messages.length - 1];
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ localServer.listen(settings.GENERAL.PORT, () => {
|
|||
startChatBubbleModule();
|
||||
|
||||
if (settings.TTS.USE_TTS) {
|
||||
// internalTTS.getInstalledVoices();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ async function playVoice(filteredMessage, logoUrl, username, message) {
|
|||
currentUsername = username;
|
||||
let textObject = { filtered: filteredMessage, formatted: message };
|
||||
let voice;
|
||||
const language = langdetect.detect(filteredMessage);
|
||||
textObject.filtered = `${username}: ${filteredMessage}`;
|
||||
|
||||
// if (
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
const tmi = require('tmi.js');
|
||||
const axios = require('axios');
|
||||
const { post } = require('request');
|
||||
|
||||
let client;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,49 +0,0 @@
|
|||
var iconv = require('iconv-lite');
|
||||
|
||||
let SelectedVoice = '';
|
||||
let Encoding = '';
|
||||
let counter = 0;
|
||||
// wrap in promise
|
||||
const speak = (textObject) =>
|
||||
new Promise((resolve) => {
|
||||
// say.setEncoding(Encoding);
|
||||
counter += 1;
|
||||
let savePath = path.join(resourcesPath, './sounds/tts/internal_audio_' + counter + '.mp3');
|
||||
|
||||
say.export(iconv.encode(textObject.filtered, 'ascii'), SelectedVoice, 1, savePath, (err) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
} else {
|
||||
sound.playAudio({ path: savePath, message: textObject });
|
||||
sound.playNotificationSound();
|
||||
}
|
||||
resolve('finished');
|
||||
});
|
||||
});
|
||||
|
||||
// queue system
|
||||
class SayQueue {
|
||||
constructor() {
|
||||
this.messages = [];
|
||||
this.status = 0;
|
||||
}
|
||||
|
||||
async shift() {
|
||||
this.status = 1;
|
||||
while (this.messages.length > 0) {
|
||||
await speak(this.messages.shift(), SelectedVoice, 1);
|
||||
}
|
||||
this.status = 0;
|
||||
}
|
||||
|
||||
add(message, selectedVoice) {
|
||||
this.messages.push(message);
|
||||
SelectedVoice = selectedVoice;
|
||||
if (this.status === 0) {
|
||||
this.shift();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const sayQueue = new SayQueue();
|
||||
module.exports = sayQueue;
|
||||
Loading…
Reference in a new issue