UCI and Interface Fixes #1

Merged
ben merged 18 commits from :main into main 1 year ago

@ -9,13 +9,13 @@ local m, s, o
m = taskd.docker_map("frigate", "Frigate NVR", "/usr/libexec/apps/frigate/frigate.sh", m = taskd.docker_map("frigate", "Frigate NVR", "/usr/libexec/apps/frigate/frigate.sh",
translate("Frigate"), translate("Frigate"),
translate("Frigate is an open-source NVR built around real-time AI object detection. All processing is performed locally on your own hardware.") translate("Frigate is an open-source NVR built around real-time AI object detection. All processing is performed locally on your own hardware.")
.. translate("Official website:") .. ' <a href=\"https://frigate.video/\" target=\"_blank\">https://frigate.video/</a>') .. "<br/>".. translate("Official website:") .. ' <a href=\"https://frigate.video/\" target=\"_blank\">https://frigate.video/</a>')
s = m:section(SimpleSection, translate("Service Status"), translate("frigate status:")) s = m:section(SimpleSection, translate("Container Status"))
s:append(Template("frigate/status")) s:append(Template("frigate/status"))
-- General Frigate Docker setup -- General Frigate Docker setup
s = m:section(TypedSection, "frigate_config", "Docker Configuration", "General settings for Docker") s = m:section(NamedSection, "docker", "frigate_config", "Docker Configuration")
s.addremove = false s.addremove = false
s.anonymous = true s.anonymous = true
@ -35,7 +35,7 @@ o = s:option(Value, "storage", "Storage Path")
o.default = "./frigate/storage" o.default = "./frigate/storage"
-- MQTT Configuration -- MQTT Configuration
s = m:section(TypedSection, "frigate_config", "MQTT Configuration", "Settings for MQTT") s = m:section(NamedSection, "mqtt", "frigate_config", "MQTT Configuration")
s.addremove = false s.addremove = false
s.anonymous = true s.anonymous = true
@ -46,7 +46,7 @@ o = s:option(Value, "host", "MQTT Host")
o.default = "mqtt.server.com" o.default = "mqtt.server.com"
-- Detectors Configuration -- Detectors Configuration
s = m:section(TypedSection, "frigate_config", "Detectors Configuration", "Settings for Detectors") s = m:section(NamedSection, "detectors", "frigate_config", "TPU Configuration")
s.addremove = false s.addremove = false
s.anonymous = true s.anonymous = true
@ -60,7 +60,7 @@ o = s:option(Value, "device", "Device")
o.default = "usb" o.default = "usb"
-- Camera Configuration -- Camera Configuration
s = m:section(TypedSection, "camera_config", "Camera Configuration", "Settings for Cameras") s = m:section(TypedSection, "camera_config", "Camera Configuration")
s.addremove = true s.addremove = true
s.anonymous = true s.anonymous = true
s.novaluetext = "There are no cameras configured yet." s.novaluetext = "There are no cameras configured yet."

@ -21,7 +21,7 @@ frigate.blocks = function()
return vals return vals
end end
frigatered.home = function() frigate.home = function()
local uci = require "luci.model.uci".cursor() local uci = require "luci.model.uci".cursor()
local home_dirs = {} local home_dirs = {}
home_dirs["main_dir"] = uci:get_first("quickstart", "main", "main_dir", "/opt/docker2/compose") home_dirs["main_dir"] = uci:get_first("quickstart", "main", "main_dir", "/opt/docker2/compose")

@ -5,7 +5,6 @@ local container_running = string.find(string.lower(container_status), "up") and
-%> -%>
<div class="cbi-value"> <div class="cbi-value">
<label class="cbi-value-title">Status</label>
<div class="cbi-value-field"> <div class="cbi-value-field">
<% if container_running then %> <% if container_running then %>
<button class="cbi-button cbi-button-success" disabled="true"><%= container_status %></button> <button class="cbi-button cbi-button-success" disabled="true"><%= container_status %></button>

@ -7,7 +7,7 @@ config frigate_config 'docker'
config frigate_config 'mqtt' config frigate_config 'mqtt'
option mqtt 'False' option mqtt 'False'
option host 'mqtt.server.com option host 'mqtt.server.com'
config frigate_config 'detectors' config frigate_config 'detectors'
option coral 'True' option coral 'True'

@ -94,15 +94,15 @@ touch /opt/docker2/compose/frigate/config.yml
camera_index=$((camera_index+1)) camera_index=$((camera_index+1))
done done
}
#rm -r /opt/docker2/compose/frigate 2>/dev/null
#mkdir -p /opt/docker2/compose/frigate
#touch /opt/docker2/compose/frigate/config.yml rm -r /opt/docker2/compose/frigate 2>/dev/null
mkdir -p /opt/docker2/compose/frigate
touch /opt/docker2/compose/frigate/config.yml
#touch /opt/docker2/compose/frigate/docker-compose.yml touch /opt/docker2/compose/frigate/docker-compose.yml
cat > /opt/docker2/compose/frigate/docker-compose.yml <<EOF cat > /opt/docker2/compose/frigate/docker-compose.yml <<EOF
version: "3.9" version: "3.9"
services: services:
@ -177,8 +177,13 @@ case "${ACTION}" in
;; ;;
"status") "status")
APP_NAME="frigate" APP_NAME="frigate"
CONTAINER_NAMES=$(docker ps -a --filter "name=${APP_NAME}" --format '{{.Names}}') CONTAINER_NAME=$(docker ps -a --filter "name=${APP_NAME}" --format '{{.Names}}')
docker ps --all -f "name=${CONTAINER_NAMES}" --format '{{.Status}}' CONTAINER_STATUS=$(docker ps --all --filter "name=${CONTAINER_NAME}" --format '{{.Status}}' | awk '/^Up/ { print "up " substr($0, 4) } !/^Up/ && /.+/ { print "down" }')
if [ -z "$CONTAINER_STATUS" ]; then
echo "${APP_NAME} is not installed"
else
echo "${CONTAINER_STATUS}"
fi
;; ;;
"port") "port")
APP_NAME="frigate" APP_NAME="frigate"

Loading…
Cancel
Save