mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
Improved error log and implemented a variable and function for file path storage
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
const { contextBridge, ipcRenderer, webUtils } = require('electron')
|
const { contextBridge, ipcRenderer, webUtils } = require('electron')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
contextBridge.exposeInMainWorld("explorer", {
|
contextBridge.exposeInMainWorld("explorer", {
|
||||||
onFileDrop: (file) => webUtils.getPathForFile(file)
|
onFileDrop: (file) => webUtils.getPathForFile(file)
|
||||||
})
|
})
|
||||||
|
contextBridge.exposeInMainWorld("extractor", {
|
||||||
|
extract: (file) => ipcRenderer.send("extract", file)
|
||||||
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error in preload.js");
|
console.log("Error in preload.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4,7 +4,8 @@ uploadContainer.addEventListener("dragover", (e) =>{
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error in renderer.js dragover listener function")
|
console.log("Error in renderer.js dragover listener function");
|
||||||
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -21,10 +22,12 @@ uploadContainer.addEventListener("drop", (e) => {
|
|||||||
console.log(filePath)
|
console.log(filePath)
|
||||||
|
|
||||||
const files1 = e.dataTransfer.files;
|
const files1 = e.dataTransfer.files;
|
||||||
|
setCurrentPathVariable(filePath);
|
||||||
handleFiles(files1);
|
handleFiles(files1);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error in renderer.js with the listerner for the drop function");
|
console.log("Error in renderer.js with the listerner for the drop function");
|
||||||
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+29
-5
@@ -1,10 +1,11 @@
|
|||||||
|
var curSelecPath = "";
|
||||||
//listener for the file explorer search
|
//listener for the file explorer search
|
||||||
manualUploadBtn.addEventListener('click', () => {
|
manualUploadBtn.addEventListener('click', () => {
|
||||||
try {
|
try {
|
||||||
videoUpload.click();
|
videoUpload.click();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error in manualBtn EventListener click");
|
console.log("Error in manualBtn EventListener click");
|
||||||
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -23,16 +24,16 @@ function checkBoxes() {
|
|||||||
|
|
||||||
if(isChecked){
|
if(isChecked){
|
||||||
//Code to submit the video
|
//Code to submit the video
|
||||||
var pathTest = fileName.textContent + "";
|
if(curSelecPath.endsWith(".mp4") || holdy.endsWith(".mov") || holdy.endsWith(".avi") || holdy.endsWith( ".mkv")){
|
||||||
if(pathTest.endsWith(".mp4") || holdy.endsWith(".mov") || holdy.endsWith(".avi") || holdy.endsWith( ".mkv")){
|
window.extractor.extract({inputVideoPath: curSelecPath, outputType:"wav"})
|
||||||
mapFunctions.get("extraction-video-to-audio").function({inputVideoPath: pathTest, outputType:"wav"});
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//language only english at the moment
|
//language only english at the moment
|
||||||
alert('Please select at least one document type.');
|
alert('Please select at least one document type.');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} 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"})
|
// mapFunctions.get("extraction-video-to-audio").function({inputVideoPath:"./a.mp4", outputType:"wav"})
|
||||||
@@ -40,6 +41,7 @@ function checkBoxes() {
|
|||||||
|
|
||||||
//language changing feature
|
//language changing feature
|
||||||
function changeLanguage(language) {
|
function changeLanguage(language) {
|
||||||
|
try {
|
||||||
if (language === 'en') {
|
if (language === 'en') {
|
||||||
document.getElementById('title').textContent = 'Video to document';
|
document.getElementById('title').textContent = 'Video to document';
|
||||||
document.getElementById('h1').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('label_summary').textContent = 'टाइमस्टैम्प के साथ सारांश';
|
||||||
document.getElementById('submitButton').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);
|
handleFiles(videoUpload.files);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error in manualBtn EventListener change");
|
console.log("Error in manualBtn EventListener change");
|
||||||
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -94,10 +102,16 @@ function handleFiles(files) {
|
|||||||
if (file.type.startsWith('video/')) {
|
if (file.type.startsWith('video/')) {
|
||||||
videoUpload.files = files;
|
videoUpload.files = files;
|
||||||
fileName.textContent = `Chosen video: ${file.name}`;
|
fileName.textContent = `Chosen video: ${file.name}`;
|
||||||
|
setCurrentPathVariable(files[0])
|
||||||
|
}else{
|
||||||
|
setCurrentPathVariable("");
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
setCurrentPathVariable("");
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error in script.js handleFiles function");
|
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}%`;
|
bar.querySelector(".progress_text").textContent = `${value}%`;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error in scripts.js updateProgressBar function");
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user