blob: e7d1922895ed58ee69527ed687b5b6c8ba6597a6 (
plain) (
blame)
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
|
<!DOCTYPE html>
<html>
<head>
<title>tmtu mode</title>
<style type="text/css">
body {
margin: 16px;
}
td {
padding-right: 16px;
padding-top: 1px;
padding-bottom: : 1px;
}
td, th {
vertical-align:top;
}
.tableheader td {
color: gray;
border-bottom: 1px solid gray;
}
.stat {
color: gray;
text-align: right;
white-space: nowrap;
padding-left: 8px
}
.tracktable {
border-left: 1px solid gray;
}
.tracktable tr:hover {
background-color: #E0E0E0;
}
.bottable tr:hover {
background-color: #E0E0E0;
}
#test:hover {
background: 2px solid red;
}
a {
color: teal;
}
a:hover {
color: red;
}
a[visited] {
color: navy
}
.addedby {
color: darkorange;
}
.botname {
}
.selected {
font-weight: 700;
}
.playing {
background: PaleGreen;
}
</style>
</head>
<body>
<table>
<tr>
<td colspan="2">
<h1>PokeBot</h1>
<p>A web interface for inspecting currently playing audio in PokeBot. Select an instance of the bot to view it's playlist and history.</p>
<nav style="display: inline-block;">
<ol>
{% let bot_name %}
{% match bot %}
{% when Some with (bot) %}
{% let bot_name = bot.name.clone() %}
{% when None %}
{% let bot_name = "".to_owned() %}
{% endmatch %}
{% for name in bot_names %}
{% if name.clone() == bot_name %}
<li><a href="/tmtu/{{ name }}" class="botname selected">{{ name }}</a></li>
{% else %}
<li><a href="/tmtu/{{ name }}" class="botname">{{ name }}</a></li>
{% endif %}
{% endfor %}
</ol>
</nav>
</td>
</tr>
{% match bot %}
{% when Some with (bot) %}
<tr>
<td colspan="2">
<h2>Status</h2>
<div class="{{ bot.state|lower }}" style="padding: 5px;">
{% match bot.currently_playing %}
{% when Some with (current) %}
<p>Currently playing: <a href="{{ current.webpage_url }}">{{ current.title }}</a></p>
<p><strong>{{ bot.position|fmt_duration }} / {{ current.duration|fmt_duration }}</strong>
{% match current.duration %}
{% when Some with (duration) %}
{% let position %}
{% match bot.position %}
{% when Some with (pos) %}
{% let position = pos.as_secs_f64() %}
{% when None %}
{% let position = 0.0 %}
{% endmatch %}
{% let progress = position / duration.as_secs_f64() %}
{% let percent = progress * 100.0 %}
<progress value="{{ percent }}" max="100" title="test"></progress></p>
{% when None %}
<progress value="0" max="100" title="test"></progress></p>
{% endmatch %}
{% when None %}
{% endmatch %}
</div>
</td>
</tr>
<tr>
<td>
<h2>Playlist</h2>
<table class="tracktable" cellspacing="0" cellpadding="0">
<tr class="tableheader">
<td class="stat">#</td>
<td>track</td>
<td>length</td>
<td>added by</td>
</tr>
{% for item in bot.playlist %}
<tr>
<td class="stat">{{ loop.index }}</td>
<td><a href="{{ item.webpage_url }}">{{ item.title }}</a></td>
<td>
{% let duration = item.duration %}
{{ duration|fmt_duration }}
</td>
<td>{{ item.added_by }}</td>
</tr>
{% endfor %}
</table>
</td>
</tr>
{% when None %}
{% endmatch %}
</table>
</body>
</html>
|