mirror of
https://github.com/sdr-enthusiasts/docker-planefence.git
synced 2025-12-22 11:17:06 +00:00
optimization of ALERT_DICT reading
This commit is contained in:
@@ -118,19 +118,13 @@ if [[ -n "$BASETIME" ]]; then echo "10a1. $(bc -l <<< "$(date +%s.%2N) - $BASETI
|
|||||||
#
|
#
|
||||||
|
|
||||||
# create an associative array / dictionary from the plane alert list
|
# create an associative array / dictionary from the plane alert list
|
||||||
|
|
||||||
declare -A ALERT_DICT
|
declare -A ALERT_DICT
|
||||||
|
|
||||||
ALERT_ENTRIES=0
|
|
||||||
while IFS="" read -r line; do
|
while IFS="" read -r line; do
|
||||||
read -d , -r hex <<< "$line" || continue
|
[[ -n "${line%%,*}" ]] && ALERT_DICT["${line%%,*}"]="$line" || "${s6wrap[@]}" echo "hey badger, bad alert-list entry: \"$line\""
|
||||||
[[ -n "$hex" ]] && ALERT_DICT["${hex}"]="$line" || echo "hey badger, bad alert-list entry: \"$line\"" && continue
|
|
||||||
((ALERT_ENTRIES=ALERT_ENTRIES+1))
|
|
||||||
done < "$PLANEFILE"
|
done < "$PLANEFILE"
|
||||||
|
|
||||||
if [[ -n "$BASETIME" ]]; then echo "10a2. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: check input for hex numbers on alert list"; fi
|
if [[ -n "$BASETIME" ]]; then echo "10a2. $(bc -l <<< "$(date +%s.%2N) - $BASETIME")s -- plane-alert.sh: check input for hex numbers on alert list"; fi
|
||||||
|
|
||||||
|
|
||||||
# Now search through the input file to see if we detect any planes in the alert list
|
# Now search through the input file to see if we detect any planes in the alert list
|
||||||
# note - we reverse the input file because later items have a higher chance to contain callsign and tail info
|
# note - we reverse the input file because later items have a higher chance to contain callsign and tail info
|
||||||
# the 'sort' command will put things back in order, but the '-u' option will make sure we keep the LAST item
|
# the 'sort' command will put things back in order, but the '-u' option will make sure we keep the LAST item
|
||||||
@@ -138,8 +132,7 @@ if [[ -n "$BASETIME" ]]; then echo "10a2. $(bc -l <<< "$(date +%s.%2N) - $BASETI
|
|||||||
|
|
||||||
tac "$INFILE" | {
|
tac "$INFILE" | {
|
||||||
while IFS="" read -r line; do
|
while IFS="" read -r line; do
|
||||||
read -d , -r hex <<< "$line"
|
if [[ -n ${ALERT_DICT["${line%%,*}"]} ]]; then
|
||||||
if [[ -n ${ALERT_DICT["${hex}"]} ]]; then
|
|
||||||
echo "${line}"
|
echo "${line}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user