diff --git a/electron/main/preload.js b/electron/main/preload.js index 355ace4..f1af256 100644 --- a/electron/main/preload.js +++ b/electron/main/preload.js @@ -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"); -} \ No newline at end of file +} diff --git a/electron/main/renderer.js b/electron/main/renderer.js index 8391a52..bba9aef 100644 --- a/electron/main/renderer.js +++ b/electron/main/renderer.js @@ -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) { + + } }); diff --git a/electron/main/script.js b/electron/main/script.js index b9ee1f0..f65920d 100644 --- a/electron/main/script.js +++ b/electron/main/script.js @@ -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) {