diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2022-06-12 15:11:29 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2022-06-12 15:11:29 +0300 |
commit | a71ed996e23498059d0a3a482e8e344efccdf297 (patch) | |
tree | 406e87812dcf9f20876b822de38c0781761cb853 | |
parent | db5e8e14fef8b6afa8d6922602a9b336f66d639b (diff) |
ipcam_motion_worker: fix timecodes reporting when using multiple roi files
-rwxr-xr-x | tools/ipcam_motion_worker.sh | 8 |
1 files 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" |