From 6f7c27d62ee95b2de5091348117da738a188fb4b Mon Sep 17 00:00:00 2001 From: Samuel ORTION Date: Thu, 25 Aug 2022 11:39:45 +0200 Subject: [PATCH] utils: Add a script replacing birdnet_miner in it work to update the database according to all files in CHUNK_FOLDER/out --- ...synchronize_model_outputs_with_database.sh | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 utils/synchronize_model_outputs_with_database.sh diff --git a/utils/synchronize_model_outputs_with_database.sh b/utils/synchronize_model_outputs_with_database.sh new file mode 100644 index 0000000..d2951d8 --- /dev/null +++ b/utils/synchronize_model_outputs_with_database.sh @@ -0,0 +1,35 @@ +#! /usr/bin/env bash +# Extract observations from a model output folder +# +set -e +# set -x + +DEBUG=${DEBUG:-1} +debug() { + [[ $DEBUG -eq 1 ]] && echo "$@" +} +if [[ -f ./config/birdnet.conf ]]; then + source ./config/birdnet.conf +else + debug "./config/birdnet.conf does not exist" + exit 1 +fi +if [[ ! -d ${CHUNK_FOLDER} ]]; then + debug "CHUNK_FOLDER ${CHUNK_FOLDER} does not exist" + exit 1 +fi + +model_outputs() { + ls ${CHUNK_FOLDER}/out/*/model.out.csv +} + +main() { + # # Remove all junk observations + # ./daemon/birdnet_clean.sh + # Get model outputs + for model_output in $(model_outputs); do + ./daemon/birdnet_output_to_sql.sh "$model_output" + done +} + +main \ No newline at end of file