-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.html
More file actions
219 lines (195 loc) · 8.33 KB
/
index.html
File metadata and controls
219 lines (195 loc) · 8.33 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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html>
<html>
<head>
<title>Bittystream - Online torrent streamer</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<link rel="stylesheet" href="https://v4-alpha.getbootstrap.com/examples/justified-nav/justified-nav.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<style>
.divider-vertical {
height: 30px;
margin: 0 9px;
margin-top: 5px;
border-left: 1px solid #F2F2F2;
border-right: 1px solid #FFF;
}
</style>
</head>
<body>
<div class="container">
<div class="masthead">
<h3 class="text-muted">BittyStream</h3>
<nav class="navbar navbar-toggleable-md bg-faded rounded mb-3">
<ul class="nav navbar-nav ">
<li class="nav-item active">
<a class="nav-link" href="/"> <i class="fa fa-home" aria-hidden="true"></i> Home <span class="sr-only">(current)</span></a>
</li>
<li class="divider-vertical"></li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/atmoner/Bittystream" target="_blank"> <i class="fa fa-github" aria-hidden="true"></i> Github</a>
</li>
<li class="divider-vertical"></li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/atmoner/Bittystream/issues" target="_blank"> <i class="fa fa-bug" aria-hidden="true"></i> Report bug</a>
</li>
</ul>
</nav>
</div>
<br />
<div align="center" class="imgLoad"></div>
<div class="return"></div>
<div class="emptyHash" style="display:none">
<div class="alert alert-warning" role="alert">
<strong>Warning!</strong> Info Hash can not be empty! See <a href="#infoForh">list of info hash </a>
</div>
</div>
<div class="jumbotron">
<h1>Info Hash</h1>
<div class="input-group mb-2 mr-sm-2 mb-sm-0">
<div class="input-group-addon"><i class="fa fa-magic fa-2x" aria-hidden="true"></i></div>
<input type="text" class="form-control form-control-lg " name="torrent" id='torrent' value="6a9759bffd5c0af65319979fb7832189f4f3c35d">
</div>
<br />
<p><a class="btn btn-lg btn-primary" role="button" id="stream"><i class="fa fa-play" aria-hidden="true"></i> Stream torrent</a></p>
</div>
<div class="alert alert-info" id="infoForh" role="alert">
<strong>Info</strong>
<br />Here is the list of exemple info hash:<br /> <br />
<table class="table">
<thead>
<tr>
<th>Info hash</th>
<th>Torrent Name</th>
<th>Torrent detail</th>
<th>Type</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">6a9759bffd5c0af65319979fb7832189f4f3c35d</th>
<td>Sintel</td>
<td><a href="http://www.freetorrent.fr/sintel-2010-1080p-mkv">Original link</a></td>
<td>Animation</td>
</tr>
<tr>
<th scope="row">f76ad565160789101bf986ba582d29584d9fee67</th>
<td>Snowden movie</td>
<td><a href="https://now.bt.co/bundles/oliver-stone-snowden-movie">Original link</a></td>
<td>Video</td>
</tr>
<tr>
<th scope="row">746483d9ab9e12a08994a6a3947faefc41dea039</th>
<td>Moby - innocents</td>
<td><a href="https://now.bt.co/bundles/moby-innocents">Original link</a></td>
<td>Audio/video</td>
</tr>
<tr>
<th scope="row">b05d8840bdae00c4c5e3df651dafd7e3d22a4647</th>
<td>Prodigy X Alchemist </td>
<td><a href="https://now.bt.co/bundles/albert-einstein">Original link</a></td>
<td>Audio</td>
</tr>
<tr>
<th scope="row">274c64b3e4c011486ca3d7bdac1ac4d642e83e73</th>
<td>One Year in 60 seconds</td>
<td></td>
<td>Video</td>
</tr>
</tbody>
</table>
</div>
<div class="row" style="display:none">
<div class="col-lg-5">
<h2>Statistics</h2>
<br />
<p>Downloaded:</p> <div id="downloaded"></div><br />
<p>Download Speed:</p> <div id="downloadSpeed"></div><br />
<p>Progress:</p> <div id="progresss"></div><br />
<p>Peers:</p> <div id="numPeers"></div> <br />
</div>
<div class="col-lg-7">
<h2>Video Stream</h2>
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: 0%; height: 20px;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">0%</div>
</div>
<div class="video">
<video width="640" height="360" autoplay preload controls type="video/mp4" src="" style="background:black"></video>
<br /> <button class="btn btn btn-primary" id="stop">Stop</button><br />
</div>
</div>
</div>
<!-- Site footer -->
<footer class="footer">
<p>© <a href="http://bittystream.pw/">BittyStream</a> 2017 - <a href="clear"> Session clear</a></p>
</footer>
</div>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<script>
$(function() {
//console.log(window.location.hostname);
var api = 'http://'+window.location.hostname+':3000/';
var refreshIntervalId = null;
$('#stream').click(function() {
window.infoHash = $('input').val();
if (infoHash == "" || infoHash == null) {
$('.emptyHash').show();
setTimeout(function() {
$(".emptyHash").hide(500)
}, 5000);
return;
}
$('.jumbotron').hide(1000);
$('.imgLoad').html('<img src="animation.gif"><br /><br />');
// Add torrent in client
$.get(api + 'add/' + infoHash, function(data) {
if (data.error) {
//Error here =)
} else {
$('.jumbotron').hide(1000);
// Check if no error
var video = api + 'stream/' + infoHash + '.mp4';
$('.imgLoad').hide();
$('#infoForh').hide();
$('.row').show(1000);
$('video').attr('src', video);
$('.video').show();
$('#return').show();
refreshIntervalId = window.setInterval(function(){
$.get(api + 'stats/' + infoHash, function(data) {
var data = jQuery.parseJSON(data);
$('#downloaded').html('<i class="fa fa-cloud-download" aria-hidden="true"></i> ' + prettyBytes(data.downloaded));
$('#downloadSpeed').html('<i class="fa fa-line-chart" aria-hidden="true"></i> ' + prettyBytes(data.downloadSpeed));
$('#progresss').html('<i class="fa fa-database" aria-hidden="true"></i> ' + (data.progress * 100).toFixed(1)+ '%');
$('.progress-bar').css("width", (data.progress * 100).toFixed(1)+ '%');
$('.progress-bar').html((data.progress * 100).toFixed(1)+ '%');
$('#numPeers').html('<i class="fa fa-eye" aria-hidden="true"></i> ' + data.numPeers);
});
}, 2000);
} // else no error
});
});
$('#stop').click(function() {
window.clearInterval(refreshIntervalId);
$('video').attr('src', '');
$('input').val('');
window.infoHash = '';
$('.jumbotron').show();
$('.video').hide();
$('.row').hide();
});
});
// Human readable bytes util
function prettyBytes(num) {
var exponent, unit, neg = num < 0, units = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
if (neg) num = -num
if (num < 1) return (neg ? '-' : '') + num + ' B'
exponent = Math.min(Math.floor(Math.log(num) / Math.log(1000)), units.length - 1)
num = Number((num / Math.pow(1000, exponent)).toFixed(2))
unit = units[exponent]
return (neg ? '-' : '') + num + ' ' + unit
}
</script>
</body>
</html>