summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2024-02-17 23:46:50 +0100
committerMatěj Cepl <mcepl@cepl.eu>2024-02-17 23:46:50 +0100
commit837d9bc7ddc0ef4dd92c33b14527f190c2dd9925 (patch)
tree740df51eeaa3d0427375fb9afc8f1e0b4817d3c9
parent373e61d539472c20048069b961fc27475586b29d (diff)
downloadISS_Above-837d9bc7ddc0ef4dd92c33b14527f190c2dd9925.tar.gz
Automatically calculate current geolocation (using ipapi.co).
-rwxr-xr-xiss_above.sh9
1 files changed, 6 insertions, 3 deletions
diff --git a/iss_above.sh b/iss_above.sh
index c67d350..1866c14 100755
--- a/iss_above.sh
+++ b/iss_above.sh
@@ -2,14 +2,17 @@
set -eu
API_URL='http://api.open-notify.org/iss-now.json'
+GEOIP_URL="https://ipapi.co/json"
API_data=$(curl -s "$API_URL")
-
latitude="$(echo $API_data|jq -r '. | .iss_position.latitude')"
longitude="$(echo $API_data|jq -r '. | .iss_position.longitude')"
-my_lat="50.0769160"
-my_long="14.4740344"
+my_location=$(curl -s "$GEOIP_URL")
+my_lat=$(echo $my_location | jq -r '. | .latitude')
+my_long=$(echo $my_location | jq -r '. | .longitude')
+# my_lat="50.0769160"
+# my_long="14.4740344"
# . "mirkarte/geo.sh"