|
|
@ -241,7 +241,7 @@ write_camera_to_yml() {
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo "Mask is empty, ignoring."
|
|
|
|
echo "Mask is empty, ignoring."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
yq eval ".cameras.$name line_comment=\"DO NOT REMOVE - Managed by PrivateRouter Script\"" -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
yq eval '(.cameras.Office | key) line_comment="DO NOT REMOVE - Managed by PrivateRouter Script"' -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
get_camera_index_by_name() {
|
|
|
|
get_camera_index_by_name() {
|
|
|
@ -259,20 +259,26 @@ get_camera_index_by_name() {
|
|
|
|
overwrite_warning_comment() {
|
|
|
|
overwrite_warning_comment() {
|
|
|
|
local name=$1
|
|
|
|
local name=$1
|
|
|
|
local attribute=$2
|
|
|
|
local attribute=$2
|
|
|
|
yq eval ".cameras.$name.$attribute line_comment=\"OVERWRITTEN_BY_ROUTER\"" -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
|
|
|
|
|
|
|
|
# Handle the special case of the list item
|
|
|
|
|
|
|
|
if [[ $attribute == "ffmpeg.inputs[0].roles" ]]; then
|
|
|
|
|
|
|
|
yq eval '(.cameras.'$name'.ffmpeg.inputs[0] | key) line_comment="OVERWRITTEN_BY_ROUTER"' -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
yq eval '(.cameras.'$name'.'$attribute' | key) line_comment="OVERWRITTEN_BY_ROUTER"' -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
remove_warning_comments() {
|
|
|
|
remove_warning_comments() {
|
|
|
|
local name=$1
|
|
|
|
local name=$1
|
|
|
|
|
|
|
|
|
|
|
|
yq '.cameras.'$name'.ffmpeg.inputs[0].path line_comment=""' -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
yq eval '.cameras.'$name'.ffmpeg.inputs[0].path line_comment=""' -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
|
|
|
|
|
|
|
|
yq '.cameras.'$name'.ffmpeg.inputs[0].roles line_comment=""' -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
yq eval '.cameras.'$name'.ffmpeg.inputs[0].roles line_comment=""' -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
|
|
|
|
|
|
|
|
yq '.cameras.'$name'.record.enabled line_comment=""' -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
yq eval '.cameras.'$name'.record.enabled line_comment=""' -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
|
|
|
|
|
|
|
|
yq '.cameras.'$name'.snapshots.enabled line_comment=""' -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
yq eval '.cameras.'$name'.snapshots.enabled line_comment=""' -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
|
|
|
|
|
|
|
|
yq '.cameras.'$name'.motion.mask line_comment=""' -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
yq eval '.cameras.'$name'.motion.mask line_comment=""' -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -308,6 +314,7 @@ update_camera_in_yml() {
|
|
|
|
else
|
|
|
|
else
|
|
|
|
yq eval "del(.cameras.$name.motion)" -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
yq eval "del(.cameras.$name.motion)" -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
yq eval '(.cameras.Office | key) line_comment="DO NOT REMOVE - Managed by PrivateRouter Script"' -i /opt/docker2/compose/frigate/config.yml
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sync_camera_config() {
|
|
|
|
sync_camera_config() {
|
|
|
@ -355,7 +362,7 @@ sync_camera_config() {
|
|
|
|
# Crosschecking and removing orphaned entry in YML not present in UCI config
|
|
|
|
# Crosschecking and removing orphaned entry in YML not present in UCI config
|
|
|
|
for yml_camera in $yml_cameras; do
|
|
|
|
for yml_camera in $yml_cameras; do
|
|
|
|
# Get the comment of this camera
|
|
|
|
# Get the comment of this camera
|
|
|
|
local comment=$(yq eval ".cameras.$yml_camera line_comment" /opt/docker2/compose/frigate/config.yml)
|
|
|
|
local comment=$(yq ".cameras.$yml_camera | key | line_comment" /opt/docker2/compose/frigate/config.yml)
|
|
|
|
|
|
|
|
|
|
|
|
# Fix for word splitting
|
|
|
|
# Fix for word splitting
|
|
|
|
set -f
|
|
|
|
set -f
|
|
|
|