Skip to content

A live bird collage card for your Home Assistant dashboard.

Use jq for processing JSON when figuring out latitude/longitude

Hugh Brown (Saint Aardvark the Carpeted)085466b35cc6
diff --git a/newinstaller.sh b/newinstaller.sh
old mode 100644
new mode 100755
index 64fa222e..a3f2f051
--- a/newinstaller.sh
+++ b/newinstaller.sh
@@ -6,11 +6,18 @@ USER=$USER
export HOME=$HOME
export USER=$USER
-branch=main
-if ! which git &> /dev/null;then
+PACKAGES_MISSING=
+for cmd in git jq ; do
+ if ! which $cmd &> /dev/null;then
+ PACKAGES_MISSING="${PACKAGES_MISSING} $cmd"
+ fi
+done
+if [[ ! -z $PACKAGES_MISSING ]] ; then
sudo apt update
- sudo apt -y install git
+ sudo apt -y install $PACKAGES_MISSING
fi
+
+branch=main
git clone -b $branch https://github.com/mcguirepr89/BirdNET-Pi.git ${HOME}/BirdNET-Pi &&
$HOME/BirdNET-Pi/scripts/install_birdnet.sh
diff --git a/scripts/install_config.sh b/scripts/install_config.sh
index e7f73367..e6ed9052 100755
--- a/scripts/install_config.sh
+++ b/scripts/install_config.sh
@@ -19,8 +19,8 @@ install_config() {
## TO BE CHANGED TO STATIC VALUES
## Please only go to 4 decimal places. Example:43.3984
-LATITUDE=$(curl -s4 ifconfig.co/json | awk '/latitude/ {print $2}' | tr -d ',')
-LONGITUDE=$(curl -s4 ifconfig.co/json | awk '/longitude/ {print $2}' | tr -d ',')
+LATITUDE=$(curl -s4 ifconfig.co/json | jq .latitude)
+LONGITUDE=$(curl -s4 ifconfig.co/json | jq .longitude)
#--------------------- BirdWeather Station Information -----------------------#
#_____________The variable below can be set to have your BirdNET-Pi____________#