-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.html
More file actions
54 lines (51 loc) · 1.69 KB
/
app.html
File metadata and controls
54 lines (51 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>ffConvert</title>
<style>
.wrapper {
display: flex;
justify-content: center;
}
.button {
position: absolute;
top: 50%;
}
</style>
<script type="text/javascript">
const {dialog} = require('electron').remote
const {ipcRenderer} = require('electron')
ipcRenderer.on('updateFileList', function (e, convertedName) {
//var list = document.getElementById('fileList');
//var entry = document.createElement('li');
//entry.appendChild(document.createTextNode(convertedName));
//list.appendChild(entry);
})
//var list = document.getElementById("listArea").innerHTML
function openDialog() {
//dialog.showOpenDialog({properties: ['openFile', 'openDirectory', 'multiSelections']})
console.log(dialog.showOpenDialog({properties: ['openFile', 'openDirectory', 'multiSelections']}, function(fileNames) {
if (fileNames === undefined) return;
var fileName = fileNames[0];
var n = fileNames.length
console.log("numer of files selected: ", n)
var progress = 0
for (var i=0; i<n; i++) {
console.log("converting file: ", fileNames[i])
progress = (i+1)/n
ipcRenderer.send('updateProgress', progress)
ipcRenderer.send('runffmpeg', fileNames[i])
}
ipcRenderer.send('removeProgress', -1)
}))
}
</script>
</head>
<body>
<div class="wrapper">
<h1>Click the button to convert</h1>
<button class="button" onclick="openDialog()">Choose videos</button>
</div>
</body>
</html>