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
|
<!doctype html>
<html>
<head>
<title>Directory Browser - {{ path }}</title>
<link rel="stylesheet" href="{{ url_for('mediabrowser.assets', filename='style.css') }}" />
<script>
function convertOneThumbnailToVideo() {
var els = document.getElementsByClassName("thumbnail");
if (els.length > 0) {
var el = els[0];
console.log("convert",el);
var videoEl = document.createElement("video");
videoEl.addEventListener("error", convertOneThumbnailToVideo, true);
videoEl.addEventListener("canplaythrough", convertOneThumbnailToVideo, true);
videoEl.setAttribute("width", 90);
videoEl.setAttribute("height", 50);
videoEl.setAttribute("autoplay", "");
videoEl.setAttribute("loop", true);
videoEl.setAttribute("src", el.getAttribute("data-video-src"));
el.parentNode.replaceChild(videoEl, el);
}
}
window.onload = function() {
convertOneThumbnailToVideo();
}
</script>
</head>
<body class="list">
{% if parent != path %}
<div>
<a href="{{ url_for('mediabrowser.listdir', path=parent) }}">
<div style="width: 100%">
<img src="{{ url_for('mediabrowser.assets', filename='parent.png') }}" />
..
</div>
</a>
</div>
{% endif %}
{% for file in files %}
{% if file['type'] == 'file' %}
<div>
<img class="thumbnail" src="{{ url_for('mediabrowser.thumbnail', path=file['fullpath']) }}"
data-video-src="{{ url_for('mediabrowser.thumbnail_video', path=file['fullpath']) }}"/>
<a href="{{ url_for('mediabrowser.watch', path=file['fullpath']) }}">
{{ file['filename'] }}
</a>
</div>
{% endif %}
{% if file['type'] == 'directory' %}
<div>
<a href="{{ file['link'] }}">
<div style="width: 100%">
<img src="{{ url_for('mediabrowser.assets', filename='directory.png') }}" />
{{ file['filename'] }}
</div>
</a>
</div>
{% endif %}
{% endfor %}
</body>
</html>
|