lws: update cam interface
This commit is contained in:
parent
cd7e5c16f3
commit
8212feaa6e
@ -66,6 +66,9 @@ return [
|
||||
'high' => [
|
||||
// fill me with names
|
||||
],
|
||||
'labels' => [
|
||||
// assoc array
|
||||
],
|
||||
],
|
||||
|
||||
'vk_sms_checker' => [
|
||||
|
@ -9,6 +9,7 @@ class MiscHandler extends RequestHandler
|
||||
$this->tpl->set([
|
||||
'grafana_sensors_url' => $config['grafana_sensors_url'],
|
||||
'grafana_inverter_url' => $config['grafana_inverter_url'],
|
||||
'cameras' => $config['cam_list']['labels']
|
||||
]);
|
||||
$this->tpl->render_page('index.twig');
|
||||
}
|
||||
@ -52,7 +53,17 @@ class MiscHandler extends RequestHandler
|
||||
public function GET_cams() {
|
||||
global $config;
|
||||
|
||||
list($hls_debug, $video_events, $high) = $this->input('b:hls_debug, b:video_events, b:high');
|
||||
list($hls_debug, $video_events, $high, $camera_ids) = $this->input('b:hls_debug, b:video_events, b:high, id');
|
||||
if ($camera_ids != '') {
|
||||
$camera_param = $camera_ids;
|
||||
$camera_ids = explode(',', $camera_ids);
|
||||
$camera_ids = array_filter($camera_ids);
|
||||
$camera_ids = array_map('trim', $camera_ids);
|
||||
$camera_ids = array_map('intval', $camera_ids);
|
||||
} else {
|
||||
$camera_ids = array_keys($config['cam_list']['labels']);
|
||||
$camera_param = '';
|
||||
}
|
||||
|
||||
$tab = $high ? 'high' : 'low';
|
||||
|
||||
@ -78,13 +89,18 @@ class MiscHandler extends RequestHandler
|
||||
if ($hls_key)
|
||||
setcookie_safe('hls_key', $hls_key);
|
||||
|
||||
$cam_filter = function($id) use ($config, $camera_ids) {
|
||||
return in_array($id, $camera_ids);
|
||||
};
|
||||
|
||||
$this->tpl->set([
|
||||
'hls_host' => $hls_host,
|
||||
'hls_proto' => $hls_proto,
|
||||
'hls_opts' => $hls_opts,
|
||||
'hls_access_key' => $config['cam_hls_access_key'],
|
||||
|
||||
'cams' => $config['cam_list'][$tab],
|
||||
'camera_param' => $camera_param,
|
||||
'cams' => array_values(array_filter($config['cam_list'][$tab], $cam_filter)),
|
||||
'tab' => $tab,
|
||||
'video_events' => $video_events
|
||||
]);
|
||||
|
@ -23,12 +23,13 @@ $router->add('inverter/set-osp/', 'Inverter set_osp');
|
||||
$router->add('inverter/status.ajax', 'Inverter status_ajax');
|
||||
|
||||
// misc
|
||||
$router->add('/', 'Misc main');
|
||||
$router->add('sensors/', 'Misc sensors_page');
|
||||
$router->add('pump/', 'Misc pump_page');
|
||||
$router->add('phpinfo/', 'Misc phpinfo');
|
||||
$router->add('cams/', 'Misc cams');
|
||||
$router->add('debug/', 'Misc debug');
|
||||
$router->add('/', 'Misc main');
|
||||
$router->add('sensors/', 'Misc sensors_page');
|
||||
$router->add('pump/', 'Misc pump_page');
|
||||
$router->add('phpinfo/', 'Misc phpinfo');
|
||||
$router->add('cams/', 'Misc cams');
|
||||
$router->add('cams/([\d,]+)/', 'Misc cams id=$(1)');
|
||||
$router->add('debug/', 'Misc debug');
|
||||
|
||||
// auth
|
||||
$router->add('auth/', 'Auth auth');
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
<nav>
|
||||
<div class="nav nav-tabs" id="nav-tab">
|
||||
<a href="/cams/" class="text-decoration-none"><button class="nav-link{% if tab == 'low' %} active{% endif %}" type="button">Low-res</button></a>
|
||||
<a href="/cams/?high=1" class="text-decoration-none"><button class="nav-link{% if tab == 'high' %} active{% endif %}" type="button">High-res</button></a>
|
||||
<a href="/cams/{{ camera_param ? camera_param~"/" : "" }}" class="text-decoration-none"><button class="nav-link{% if tab == 'low' %} active{% endif %}" type="button">Low-res</button></a>
|
||||
<a href="/cams/{{ camera_param ? camera_param~"/" : "" }}?high=1" class="text-decoration-none"><button class="nav-link{% if tab == 'high' %} active{% endif %}" type="button">High-res</button></a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
@ -23,6 +23,12 @@
|
||||
<li class="list-group-item"><a href="/inverter/">Инвертор</a> (<a href="{{ grafana_inverter_url }}">Grafana</a>)</li>
|
||||
<li class="list-group-item"><a href="/pump/">Насос</a></li>
|
||||
<li class="list-group-item"><a href="/sensors/">Датчики</a> (<a href="{{ grafana_sensors_url }}">Grafana</a>)</li>
|
||||
<li class="list-group-item"><a href="/cams/">Камеры</a></li>
|
||||
</ul>
|
||||
|
||||
<h6 class="mt-4"><a href="/cams/"><b>Все камеры</b></a> (<a href="/cams/?high=1">HQ</a>)</h6>
|
||||
<ul class="list-group list-group-flush">
|
||||
{% for id, name in cameras %}
|
||||
<li class="list-group-item"><a href="/cams/{{ id }}/">{{ name }}</a> (<a href="/cams/{{ id }}/?high=1">HQ</a>)</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
Loading…
x
Reference in New Issue
Block a user