ipcam_motion_worker: fix timecodes reporting when using multiple roi files

This commit is contained in:
Evgeny Zinoviev 2022-06-12 15:11:29 +03:00
parent db5e8e14fe
commit a71ed996e2

View File

@ -154,6 +154,7 @@ process_remote() {
do_motion() {
local input="$1"
local roi_file="$(get_roi_file)"
local tc
local timecodes=()
if [ -z "$roi_file" ]; then
@ -162,12 +163,15 @@ do_motion() {
echoinfo "using roi sets from file: ${BOLD}$roi_file"
while read line; do
if ! [[ "$line" =~ ^#.* ]]; then
timecodes+=("$(do_dvr_scan "$input" "$line")")
tc="$(do_dvr_scan "$input" "$line")"
if [ -n "$tc" ]; then
timecodes+=("$tc")
fi
fi
done < <(cat "$roi_file")
fi
timecodes="${timecodes[@]}"
timecodes="$(echo "${timecodes[@]}" | sed 's/ */ /g' | xargs)"
timecodes="${timecodes// /,}"
echo "$timecodes"