implemented first version of the modular IPC system

This commit is contained in:
2025-11-17 18:00:04 +01:00
parent 4b72568ad3
commit 4dc53b9d5f
5 changed files with 149 additions and 18 deletions
@@ -32,11 +32,11 @@ module.exports = {
hideCursor: true
});
try {
// if (meta.url === `file://${process.argv[1]}`) {
return new Promise((resolve, reject) => {
this.extractAudioFromVideo(parameter.inputVideoPath, progressBar, parameter.outputType)
.then(() => console.log('Audio extraction successful.'))
.then((resp) => resolve(resp))
.catch((err) => console.error(err));
// }
})
} catch (error) {
console.log(parameter.outputType);
@@ -75,7 +75,7 @@ module.exports = {
progressBar.update(100, { timemark: 'done' });
progressBar.stop();
console.log(`Extraction completed: ${outputAudioPath}`);
resolve();
resolve(outputAudioPath);
})
.on('error', (err) => {
progressBar.stop();
+3
View File
@@ -9,5 +9,8 @@ module.exports = {
// mapFunctions.get("extraction-video-to-audio").function({inputVideoPath:"./a.mp4", outputType:"wav"})
// mapFunctions.get("extraction-video-to-audio").function({inputVideoPath:"./b.mp4", outputType:"wav"})
// mapFunctions.get("extraction-video-to-audio").function({inputVideoPath:"./b.mp4", outputType:"flac"})
// mapFunctions.get("ipc-handler").function("extraction-video-to-audio", {inputVideoPath:"./a.mp4", outputType:"flac"})
}
}
@@ -0,0 +1,16 @@
module.exports = {
name:"module-handler", // Unique name for our function that will later be used to get the function from the map via "mapFunctions.get("example").function()"
async function(module,parameter){
return new Promise(async (resolve, reject) => {
if(mapFunctions.get(module) == undefined){
reject("requested modules not found")
return
}
mapFunctions.get(module).function(parameter).then((result) => {
resolve(result)
}).catch((err) => {
reject(err)
});
})
}
}