-
Notifications
You must be signed in to change notification settings - Fork 6
/
config.php
372 lines (366 loc) · 11.3 KB
/
config.php
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
<?php
$page_title = 'Configuration';
include_once('./head.php');
$clashmodes = array(
0 => "Off:",
1 => "Single tuner:",
2 => "Multiple tuners:");
$tags = get_channeltags();
?>
<script>
function one2two() {
m1len = m1.length ;
for ( i=0; i<m1len ; i++){
if (m1.options[i].selected == true ) {
m2len = m2.length;
m2.options[m2len]= new Option(m1.options[i].text);
}
}
for ( i = (m1len -1); i>=0; i--){
if (m1.options[i].selected == true ) {
m1.options[i] = null;
}
}
}
function two2one() {
m2len = m2.length ;
for ( i=0; i<m2len ; i++){
if (m2.options[i].selected == true ) {
m1len = m1.length;
m1.options[m1len]= new Option(m2.options[i].text);
}
}
for ( i=(m2len-1); i>=0; i--) {
if (m2.options[i].selected == true ) {
m2.options[i] = null;
}
}
}
function selectAll() {
for (i=0; i<m2.length; i++) {
m2.options[i].selected = true;
}
}
</script>
<div id="layout">
<div id="banner">
<table>
<tr>
<td class="col_title">
<div id='mobmenu'>☰</div> <h1>Configuration</h1>
</td>
</tr>
</table>
</div>
<div id='wrapper'>
<div id='config'>
<form action="configure.php" method="post" name="FormName">
<table class="group">
<tr class="heading">
<td colspan="2"><h2>TVHeadend Server</h2></td>
</tr>
<tr class="row_alt" title="Name of a TVheadend user with admin privilege">
<td class="col_label"><h5>Username:</h5></td>
<?php
echo "<td class='col_value'><input type='text' name='USER' value='$user' size='16'>";
?>
</td>
</tr>
<tr class="row_alt" title="Password of the TVheadend user">
<td class="col_label"><h5>Password:</h5></td>
<?php
echo "<td class='col_value'><input type='password' name='PASS' value='$pass' size='16'></td>";
?>
</tr>
<tr class="row_alt" title="IP address & port of the TVheadend server, eg 192.168.0.1:9981">
<td class="col_label"><h5>IP Address:port:</h5></td>
<?php
echo "<td class='col_value'><input type='text' name='IP' value='$ip' size='24'></td>";
?>
</tr>
<tr class='row_alt' title="TVheadend profile to use for recordings.">
<?php
$prof = get_profiles();
if (isset($prof)) {
echo "<td class='col_label'><h5>Recording Profile:</h5></td>";
echo "<td class='col_value'><select name='UUID'>";
if (!isset($config_uuid)) $config_uuid = $prof[0]['uuid'];
foreach ($prof as $p) {
if (!$p['enabled']) continue;
$pname = $p['name'];
if ($pname == '') $pname = '(default)';
if ($p['uuid'] === $config_uuid) $sel = 'selected';
else $sel = '';
echo "<option value='{$p['uuid']}' $sel>$pname</option>";
}
?>
</td>
</tr>
<tr class='row_alt' title="TVheadend profile to use for streaming.">
<td class='col_label'><h5>Streaming Profile:</h5></td>
<td class='col_value'><select name='SUUID'>
<?php
$sprof = get_stream_profiles();
foreach ($sprof as $p) {
$sel = '';
if (isset($config_suuid)) {
if ($p['uuid'] === $config_suuid) $sel = 'selected';
}
else {
if ($p['default']) $sel = 'selected';
}
echo "<option value='{$p['uuid']}' $sel>{$p['name']}</option>";
}
?>
</tr>
</table>
<table class='group'>
<tr class='heading'>
<td colspan='2'><h2>Preferences</h2></td>
</tr>
<tr class='row_alt' title='Select display theme'>
<td class='col_label'><h5>Display theme:</h5></td>
<td class='col_value'>
<?php
if (!isset($settings['THEME'])) $settings['THEME'] = 0;
foreach ($themes as $key=>$value) {
echo "<label for='C$key'>$value:</label>";
echo "<input type='radio' name='THEME' id='C$key' value='$key'";
if ($key == $settings['THEME']) echo " checked>";
else echo ">";
}
echo "
</td>
</tr>
<tr class='row_alt' title='Time after which entries appear on tomorrow's EPG. Useful if you watch TV after midnight'>
<td class='col_label'><h5>EPG Day starts at:</h5></td>
<td class='col_value'>
<select name='EPGSTART'>";
for ($st=0; $st<7; $st++) {
echo "<option value='$st'";
if (isset($epg_start) && ($st == $epg_start)) echo " selected";
echo ">$st:00</option>";
}
echo "</select>
</td>
</tr>
<tr class='row_alt' title='Screen shown when entering TVHadmin'>
<td class='col_label'><h5>Home Page:</h5></td>
<td class='col_value'>
<select name='HOME'>";
foreach ($pages as $key=>$value) {
echo "<option value='$key'";
if (isset($settings['HOME']) && ($key == $settings['HOME'])) echo " selected";
echo ">$value</option>";
}
echo "</select>
</td>
</tr>
<tr class='row_alt' title='Sort channels by name or Logical Channel Number'>
<td class='col_label'><h5>Channels Sort Order:</h5></td>
<td class='col_value'>";
if (!isset($settings['CSORT'])) $settings['CSORT'] = 0;
foreach ($c_orders as $key=>$value) {
echo "<label for='C$key'>$value:</label>";
echo "<input type='radio' name='CSORT' id='C$key' value='$key'";
if ($key == $settings['CSORT']) echo " checked>";
else echo ">";
}
echo "
</td>
</tr>
<tr class='row_alt' title='Which TVH tags are to be used for filtering. Click 'Save' after changing this selection to update the other preferences'>
<td class='col_label'><h5>Media Tags to use for selection:</h5></td>
<td class='col_value'>";
foreach ($tags as $t=>$v) {
$g = urlencode("Tag_" . $t);
echo "$t: <input type='checkbox' name='$g' ";
if (isset($settings[$g])) {
echo " checked";
}
echo ">";
}
echo "
</td>
</tr>
<tr class='row_alt' title='Refresh the Whats On Now and Timeline screens every minute'>
<td class='col_label'><h5>Refresh Whats On Now and Timeline screens:</h5></td>
<td class='col_value'><input type='checkbox' name='REFR'";
if (isset($settings['REFR'])) {
echo " checked";
}
echo ">
</td>
</tr>
<tr class='row_alt' title='Log in to TVheadend when viewing recordings or live TV through TVHadmin. Not needed if you have an anonymous ('*') user'>
<td class='col_label'><h5>Send user/pass when Viewing:</h5></td>
<td class='col_value'><input type='checkbox' name='NOANON'";
if (isset($settings['NOANON'])) {
echo " checked";
}
echo ">
</td>
</tr>
<tr class='row_alt' title='Show icon instead of channel name. Needs picons installed and imagecache enabled on TVHeadend'>
<td class='col_label'><h5>Show channel icons in What's On Now & Recordings:</h5></td>
<td class='col_value'><input type='checkbox' name='ICONS'";
if (isset($settings['ICONS'])) {
echo " checked";
}
echo ">
</td>
</tr>
<tr class='row_alt' title='Show timer conflicts. Multiple tuner option is experimental and needs ADMIN privilege.'>
<td class='col_label'><h5>Detect timer clashes:</h5></td>
<td class='col_value'>";
if (!isset($settings['CLASHMODE'])) $settings['CLASHMODE'] = 0;
foreach ($clashmodes as $key=>$value) {
echo "<label for='T$key'>$value</label>";
echo "<input type='radio' name='CLASHMODE' id='T$key' value='$key'";
if ($key == $settings['CLASHMODE']) echo " checked>";
else echo ">";
}
echo "</td>
</tr>
<tr class='row_alt' title='Time period for the Timeline screen'>
<td class='col_label'><h5>Timeline length:</h5></td>
<td class='col_value'>
<select name='TIMESPAN'>";
foreach (array(2, 4, 6) as $st) {
echo "<option value='$st'";
if (isset($settings['TIMESPAN']) && ($st == $settings['TIMESPAN'])) echo " selected";
echo ">$st hours</option>";
}
echo "</select>
</td>
</tr>
</table>
<table class='group'>
<tr class='heading'>
<td colspan='2'><h2>Defaults</h2></td>
</tr>
<tr class='row_alt' title='Default filter setting for the What's On Now
screen'>
<td class='col_label'><h5>Show in What's On Now:</h5></td>
<td class='col_value'>";
foreach ($tags as $t=>$v) {
$ut = urlencode($t);
if (isset($settings["Tag_$ut"])) {
$g = "Media_" . $ut;
echo "$t: <input type='checkbox' name='$g' ";
if (isset($settings[$g])) {
echo " checked";
}
echo ">";
}
}
echo "
</td>
</tr>
<tr class='row_alt' title='Default filter setting for the Timeline screen'>
<td class='col_label'><h5>Show in Timeline:</h5></td>
<td class='col_value'>";
foreach ($tags as $t=>$v) {
$ut = urlencode($t);
if (isset($settings["Tag_$ut"])) {
$g = "Time_" . $ut;
echo "$t: <input type='checkbox' name='$g' ";
if (isset($settings[$g])) {
echo " checked";
}
echo ">";
}
}
echo "
</td>
</tr>
<tr class='row_alt' title='Default filter setting for Recordings'>
<td class='col_label'><h5>Show in Recordings:</h5></td>
<td class='col_value'>";
foreach ($tags as $t=>$v) {
$ut = urlencode($t);
if (isset($settings["Tag_$ut"])) {
$g = "Rec_" . $ut;
echo "$t: <input type='checkbox' name='$g' ";
if (isset($settings[$g])) {
echo " checked";
}
echo ">";
}
}
echo "
</td>
</tr>
<tr class='row_alt' title='Sort recordings by date or by title (ignoring 'New:')'>
<td class='col_label'><h5>Recordings Sort Order:</h5></td>
<td class='col_value'>";
if (!isset($settings['SORT'])) $settings['SORT'] = 0;
foreach ($orders as $key=>$value) {
echo "<label for='B$key'>$value:</label>";
echo "<input type='radio' name='SORT' id='B$key' value='$key'";
if ($key == $settings['SORT']) echo " checked>";
else echo ">";
}
echo "
</td>
</tr>
</table>
<table class='group'>
<tr class='heading'>
<td colspan='3'><h2>Favourite Channels</h2></td>
</tr>
<tr class='row_alt'>
<td class='col_channels'>
<select name='all_channels' size='8' multiple='multiple' class='channels'>";
$chans = get_channels();
foreach($chans as $v) {
$cname = $v["name"];
print "<option value='$cname'>$cname</option>";
}
echo "</select>
</td>
<td style='text-align: center;'>
<input type='button' onClick='one2two()' value='>>>>>'><br>
<input type='button' onClick='two2one()' value='<<<<<'>
</td>
<td class='col_wanted_channels'>
<select name='selected_channels[]' size='8' multiple='multiple' class='channels'>";
$sel = &$settings['selected_channels'];
foreach($sel as $s) {
echo "<option value='$s'>$s</option>";
}
echo "</select>
</td>
</tr>";
$save = "Save";
}
else {
echo "
<input type='hidden' name='Tag_All' value='on'>
<input type='hidden' name='Media_All' value='on'>
<input type='hidden' name='Time_All' value='on'>
<input type='hidden' name='Rec_All' value='on'>";
$save = "Connect";
}
echo "
</table>
<div id='buttons'>
<input type='submit' class='submit' name='save' value=$save onclick='selectAll()'>
</div>
</form>";
?>
<script>
// IMPORTANT: this is the extra bit of code
// shorthand for referring to menus
// must run after document has been created
// you can also change the name of the select menus and
// you would only need to change them in one spot, here
var m1 = document.FormName.all_channels;
var m2 = document.FormName.elements['selected_channels[]'];
</script>
</div>
</div>
</div>
</div>
</body>
</html>