mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
Implemented first version of the json object that should be send back to the main. as well as fixed some bugs
This commit is contained in:
+62
-4
@@ -4,10 +4,11 @@ function checkBoxes() {
|
||||
try {
|
||||
const checkboxes = document.querySelectorAll('input[name="docFormat"]');
|
||||
let isChecked = false;
|
||||
|
||||
var checkedCounter = 0;
|
||||
checkboxes.forEach(function(checkbox){
|
||||
if(checkbox.checked){
|
||||
isChecked = true;
|
||||
checkedCounter++;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -19,11 +20,48 @@ function checkBoxes() {
|
||||
selectedCheckboxes[checkbox.nextElementSibling.textContent] = "";
|
||||
}
|
||||
});
|
||||
console.log(selectedCheckboxes);
|
||||
|
||||
const testEndings = [".mp4", ".mov", ".avi", ".mkv"];
|
||||
var pathTest = window.electronAPI.getFilePath(videoUpload.files[0]);
|
||||
if(pathTest.endsWith(".mp4") || pathTest.endsWith(".mov") || pathTest.endsWith(".avi") || pathTest.endsWith( ".mkv")){
|
||||
var pathToLower = pathTest.toLowerCase();
|
||||
if(testEndings.some(e => pathToLower.endsWith(e))){
|
||||
document.getElementById("progressbar").style.visibility = "visible";
|
||||
//assembly of the json for the main
|
||||
|
||||
const selectedStyles = [checkedCounter];
|
||||
var iter = 0;
|
||||
checkboxes.forEach(function(checkbox){
|
||||
if(checkbox.checked){
|
||||
console.log(checkbox.value);
|
||||
selectedStyles[iter] = {iter: checkbox.value};
|
||||
iter++;
|
||||
}
|
||||
});
|
||||
console.log(selectedCheckboxes);
|
||||
const outputType = document.getElementById("output_type");
|
||||
const transcriptionType = document.getElementById("transkript_type");
|
||||
const aiType = document.getElementById("ai_type");
|
||||
const sendingPackage = {
|
||||
"video": {
|
||||
"module":"extraction-video-toaudio",
|
||||
"inputVideoPath": pathTest,
|
||||
"outputType": outputType.value
|
||||
},
|
||||
"transcription": {
|
||||
"module": transcriptionType.value
|
||||
},
|
||||
"document": {
|
||||
"module":aiType.value,
|
||||
"style": selectedStyles
|
||||
}
|
||||
};
|
||||
console.log(sendingPackage);
|
||||
|
||||
|
||||
|
||||
//window.extractor.extract({inputVideoPath: pathTest, outputType:"wav"});
|
||||
}else{
|
||||
alert('The given file is not compatible. These are the available types: [".mp4", ".mov", ".avi", ".mkv"].');
|
||||
}
|
||||
} else {
|
||||
//language only english at the moment
|
||||
@@ -68,6 +106,7 @@ function handleFiles(files) {
|
||||
videoUpload.files = files;
|
||||
fileName.textContent = `Chosen video: ${file.name}`;
|
||||
generateThumbnail(filePath);
|
||||
activateSubmitBtn(true);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -96,7 +135,7 @@ function loadAiOptions(options){
|
||||
var menu = document.getElementById('ai_type');
|
||||
var object_holdy;
|
||||
var choice ;
|
||||
object_holdy = Object.keys(languageOptions);
|
||||
object_holdy = Object.keys(options);
|
||||
for(i = 0; i < options.length; i++){
|
||||
choice = document.createElement('option');
|
||||
choice.textContent = object_holdy[i];
|
||||
@@ -109,6 +148,25 @@ function loadAiOptions(options){
|
||||
}
|
||||
}
|
||||
|
||||
//function to load transcription options to the drop down list
|
||||
function loadTranscriptionOptions(options){
|
||||
try {
|
||||
var menu = document.getElementById('transkript_type');
|
||||
var object_holdy;
|
||||
var choice ;
|
||||
object_holdy = Object.keys(options);
|
||||
for(i = 0; i < options.length; i++){
|
||||
choice = document.createElement('option');
|
||||
choice.textContent = object_holdy[i];
|
||||
choice.value = object_holdy[i];
|
||||
menu.appendChild(choice);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error in script.js function loadTranscriptionOptions");
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
//function to load language options to the drop down list
|
||||
function loadLanguageOptions(){
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user