Implemented the interaction between the gui and main so that the ai/transcript names get loaded inside the dropdowns

This commit is contained in:
2025-11-24 12:52:49 +01:00
parent b4f2ed561d
commit 6531f5f51c
3 changed files with 25 additions and 20 deletions
+9 -1
View File
@@ -10,6 +10,14 @@ try {
contextBridge.exposeInMainWorld("electronAPI", {
getFilePath: (file) => {return webUtils.getPathForFile(file)}
})
contextBridge.exposeInMainWorld("onStartup", {
getModuleNames: (file) => { ipcRenderer.send("get_modules", "")}
})
ipcRenderer.on("modules", (event, resp) => {
loadAiOptions(resp.ai_modules);
loadTranscriptionOptions(resp.transcription_modules);
})
} catch (error) {
console.log("Error in preload.js");
}
}
+8 -7
View File
@@ -32,13 +32,14 @@ uploadContainer.addEventListener("drop", (e) => {
})
window.addEventListener('load', (e) => {
try {
console.log("test");
loadLanguageOptions();
} catch (error) {
}
window.addEventListener('load', (e) => {
try {
console.log("test");
loadLanguageOptions();
window.onStartup.getModuleNames();
} catch (error) {
}
});
+8 -12
View File
@@ -55,11 +55,7 @@ function checkBoxes() {
"style": selectedStyles
}
};
console.log(sendingPackage);
//window.extractor.extract({inputVideoPath: pathTest, outputType:"wav"});
ipcRenderer.send("file_submit", sendingPackage)
}else{
alert('The given file is not compatible. These are the available types: [".mp4", ".mov", ".avi", ".mkv"].');
}
@@ -137,11 +133,11 @@ function loadAiOptions(options){
var menu = document.getElementById('ai_type');
var object_holdy;
var choice ;
object_holdy = Object.keys(options);
object_holdy = options
for(i = 0; i < options.length; i++){
choice = document.createElement('option');
choice.textContent = object_holdy[i];
choice.value = object_holdy[i];
choice.textContent = object_holdy[i].displayname;
choice.value = object_holdy[i].name;
menu.appendChild(choice);
}
} catch (error) {
@@ -153,14 +149,14 @@ function loadAiOptions(options){
//function to load transcription options to the drop down list
function loadTranscriptionOptions(options){
try {
var menu = document.getElementById('transkript_type');
var menu = document.getElementById('ai_type');
var object_holdy;
var choice ;
object_holdy = Object.keys(options);
object_holdy = options
for(i = 0; i < options.length; i++){
choice = document.createElement('option');
choice.textContent = object_holdy[i];
choice.value = object_holdy[i];
choice.textContent = object_holdy[i].displayname;
choice.value = object_holdy[i].name;
menu.appendChild(choice);
}
} catch (error) {