From a71ed996e23498059d0a3a482e8e344efccdf297 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Sun, 12 Jun 2022 15:11:29 +0300 Subject: ipcam_motion_worker: fix timecodes reporting when using multiple roi files --- tools/ipcam_motion_worker.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/ipcam_motion_worker.sh b/tools/ipcam_motion_worker.sh index 8e5a993..47f7aae 100755 --- a/tools/ipcam_motion_worker.sh +++ b/tools/ipcam_motion_worker.sh @@ -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" -- cgit v1.2.3