Improved error log and implemented a variable and function for file path storage

This commit is contained in:
2025-11-12 20:14:56 +01:00
parent c8cbd4e92a
commit 1a681eb2b8
3 changed files with 38 additions and 11 deletions
+29 -5
View File
@@ -1,10 +1,11 @@
var curSelecPath = "";
//listener for the file explorer search
manualUploadBtn.addEventListener('click', () => {
try {
videoUpload.click();
} catch (error) {
console.log("Error in manualBtn EventListener click");
console.log(error);
}
});
@@ -23,16 +24,16 @@ function checkBoxes() {
if(isChecked){
//Code to submit the video
var pathTest = fileName.textContent + "";
if(pathTest.endsWith(".mp4") || holdy.endsWith(".mov") || holdy.endsWith(".avi") || holdy.endsWith( ".mkv")){
mapFunctions.get("extraction-video-to-audio").function({inputVideoPath: pathTest, outputType:"wav"});
if(curSelecPath.endsWith(".mp4") || holdy.endsWith(".mov") || holdy.endsWith(".avi") || holdy.endsWith( ".mkv")){
window.extractor.extract({inputVideoPath: curSelecPath, 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"})
@@ -40,6 +41,7 @@ function checkBoxes() {
//language changing feature
function changeLanguage(language) {
try {
if (language === 'en') {
document.getElementById('title').textContent = 'Video to document';
document.getElementById('h1').textContent = 'Video to document';
@@ -71,6 +73,11 @@ function changeLanguage(language) {
document.getElementById('label_summary').textContent = 'टाइमस्टैम्प के साथ सारांश';
document.getElementById('submitButton').textContent = 'जमा करना';
}
} catch (error) {
console.log("Error in script.js changeLanguage function");
console.log(error);
}
}
@@ -80,6 +87,7 @@ videoUpload.addEventListener('change', () => {
handleFiles(videoUpload.files);
} catch (error) {
console.log("Error in manualBtn EventListener change");
console.log(error);
}
});
@@ -94,10 +102,16 @@ function handleFiles(files) {
if (file.type.startsWith('video/')) {
videoUpload.files = files;
fileName.textContent = `Chosen video: ${file.name}`;
setCurrentPathVariable(files[0])
}else{
setCurrentPathVariable("");
}
}else{
setCurrentPathVariable("");
}
} catch (error) {
console.log("Error in script.js handleFiles function");
console.log(error);
}
}
@@ -110,6 +124,16 @@ function updateProgressBar(bar, value){
bar.querySelector(".progress_text").textContent = `${value}%`;
} catch (error) {
console.log("Error in scripts.js updateProgressBar function");
console.log(error);
}
}
function setCurrentPathVariable(value){
try {
curSelecPath = value + "";
} catch (error) {
console.log("Error in script.js setCurrentPathVariable");
console.log(error);
}
}