mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
43 lines
1.7 KiB
JavaScript
43 lines
1.7 KiB
JavaScript
const { contextBridge, ipcRenderer, webUtils } = require('electron')
|
|
|
|
try {
|
|
contextBridge.exposeInMainWorld("explorer", {
|
|
onFileDrop: (file) => webUtils.getPathForFile(file)
|
|
})
|
|
contextBridge.exposeInMainWorld("extractor", {
|
|
extract: (file) => {
|
|
|
|
let q = // TODO get rid of this example code and have the actual json object be sent
|
|
{
|
|
video: {
|
|
module: "extraction-video-to-audio", // The name of the module, idk if we ever implement other extraction modules, the default one is extraction-video-to-audio
|
|
inputVideoPath: file.inputVideoPath, // See script.js on line 27 for an example of what this should look like
|
|
outputType: file.outputType // The file format to be used for the audio output file, such as wav, mp3, flac and so on
|
|
},
|
|
transcription:{
|
|
module: "String" // The module name of the transcription model you want to use
|
|
},
|
|
document:{
|
|
module: "String", // The module name of the AI model you want to use to create the document
|
|
styles: [ // An array of all the document styles/prompts you want to have the document be processed with
|
|
{
|
|
prompt: "String",
|
|
}
|
|
]
|
|
}
|
|
}
|
|
// ipcRenderer.send("file_submit", {module:"extraction-video-to-audio", parameter:file})
|
|
ipcRenderer.send("file_submit", q)
|
|
}
|
|
})
|
|
contextBridge.exposeInMainWorld("electronAPI", {
|
|
getFilePath: (file) => {return webUtils.getPathForFile(file)}
|
|
})
|
|
|
|
ipcRenderer.on("progress", (event, resp) => {
|
|
alert(`Finished step ${resp.curstep} of ${resp.totalsteps}`)
|
|
})
|
|
ipcRenderer.on("error", (event, err) => {alert(err)})
|
|
} catch (error) {
|
|
console.log("Error in preload.js");
|
|
} |