-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
80 lines (72 loc) · 2.46 KB
/
index.html
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>spotify data</title>
<style media="screen">
.progressBar {
background: lightgreen;
width: 0;
height: 100%;
z-index: -1;
overflow: hidden;
position: absolute;
top: 0;
left: 0;
}
.progressBarWrapper {
width: 100%;
background: lightblue;
text-align: center;
z-index: -2;
overflow: hidden;
position: relative;
}
.percentage {
color: white;
font-size: 4rem
}
</style>
</head>
<body>
<h1>your downloads have started in the terminal</h1>
<p>if the download is done you can stop the program by pressing CTRL+C in the terminal</p>
<div class="progressBarWrapper">
<h1 class="percentage">0%</h1>
<div class="progressBar"></div>
</div>
<p>if it's stuck at 99% or something try killing the youtube-dl processes, it will restart the download and it will work</p>
<p>ignore the errors in the terminal, it will try to download it again</p>
<script src="http://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.3/socket.io.min.js" charset="utf-8"></script>
<script type="text/javascript">
var socket = io("http://localhost:8000");
socket.emit("token", getParams());
socket.on("progress", function(percentage) {
percentage = Math.round(percentage);
document.getElementsByClassName("percentage")[0].innerHTML = percentage+"%";
document.getElementsByClassName("progressBar")[0].style.width = percentage+"%";
});
function getParams() {
var params = window.location.search.substring(1);
if (params == "") {
console.log("nothing found!");
return
} else {
var arg = {};
while (params.indexOf("=") > -1) {
var value;
if (params.indexOf("&") > -1) {
value = params.substring(params.indexOf("=")+1, params.indexOf("&"));
arg[params.substring(0, params.indexOf("="))] = value;
params = params.substring(params.indexOf("=")+value.length+2, params.length);
} else {
arg[params.substring(0, params.indexOf("="))] = params.substring(params.indexOf("=")+1, params.length);
params = params.substring(params.indexOf("=")+1, params.length);
}
}
}
return arg;
}
</script>
</body>
</html>