Fixed a merg mistake and added try/catch lines

This commit is contained in:
2025-11-17 11:27:17 +01:00
parent ab0e737f33
commit 1e3d830ae2
2 changed files with 38 additions and 14 deletions
+14 -5
View File
@@ -30,12 +30,21 @@ uploadContainer.addEventListener("drop", (e) => {
window.addEventListener('load', (e) => {
console.log("test");
loadLanguageOptions();
try {
console.log("test");
loadLanguageOptions();
} catch (error) {
}
});
language_option.addEventListener('change', (e)=>{
const select = document.getElementById('language_option');
console.log(select.value);
changeLanguage(select.value);
try {
const select = document.getElementById('language_option');
changeLanguage(select.value);
} catch (error) {
}
});
+24 -9
View File
@@ -4,6 +4,7 @@ manualUploadBtn.addEventListener('click', () => {
videoUpload.click();
} catch (error) {
console.log("Error in manualBtn EventListener click");
console.log(error);
}
});
@@ -23,18 +24,18 @@ function checkBoxes() {
if(isChecked){
//Code to submit the video
var pathTest = window.electronAPI.getFilePath(videoUpload.files[0]);
if(pathTest.endsWith(".mp4") || holdy.endsWith(".mov") || holdy.endsWith(".avi") || holdy.endsWith( ".mkv")){
window.extractor.extract({inputVideoPath: pathTest, outputType:"wav"})
if(pathTest.endsWith(".mp4") || pathTest.endsWith(".mov") || pathTest.endsWith(".avi") || pathTest.endsWith( ".mkv")){
window.extractor.extract({inputVideoPath: pathTest, outputType:"wav"});
}
} else {
//language only english at the moment
alert('Please select at least one document type.');
}
} catch (error) {
console.log(error)
console.log("Error in script.js checkBoxes function");
console.log(error);
}
// mapFunctions.get("extraction-video-to-audio").function({inputVideoPath:"./a.mp4", outputType:"wav"})
}
//language changing feature
@@ -50,6 +51,7 @@ function changeLanguage(language) {
document.getElementById('label_summary').textContent = languageOptions[language].label_summary;
document.getElementById('submitButton').textContent = languageOptions[language].submitButton;
} catch (error) {
console.log("Error in script.js changeLanguage function");
console.log(error);
}
@@ -61,6 +63,7 @@ videoUpload.addEventListener('change', () => {
handleFiles(videoUpload.files);
} catch (error) {
console.log("Error in manualBtn EventListener change");
console.log(error);
}
});
@@ -77,6 +80,7 @@ function handleFiles(files) {
}
} catch (error) {
console.log("Error in script.js handleFiles function");
console.log(error);
}
}
@@ -89,6 +93,7 @@ function updateProgressBar(bar, value){
bar.querySelector(".progress_text").textContent = `${value}%`;
} catch (error) {
console.log("Error in scripts.js updateProgressBar function");
console.log(error);
}
}
@@ -136,14 +141,24 @@ function activateSubmitBtn(hasFile){
}
videoUpload.addEventListener("change", () => {
activateSubmitBtn(videoUpload.files.length > 0);
try {
activateSubmitBtn(videoUpload.files.length > 0);
} catch (error) {
console.log(error);
}
});
uploadContainer.addEventListener("drop", (e) => {
e.preventDefault();
const file = e.dataTransfer.files[0];
try {
e.preventDefault();
const file = e.dataTransfer.files[0];
if(file){
activateSubmitBtn(true);
if(file){
activateSubmitBtn(true);
}
} catch (error) {
console.log(error);
}
});