+++ ~/.zen/tmp/${IPFSNODEID}/weather.txt +++

This commit is contained in:
fred 2024-02-25 20:07:49 +01:00
parent 066710056b
commit ea7ba67add
3 changed files with 30 additions and 13 deletions

View File

@ -102,18 +102,8 @@ if [[ ${QRCODE} == "station" ]]; then
ISTATION=$(cat ~/.zen/tmp/ISTATION)
fi
## GET SATELLITE IMAGE
source ~/.zen/GPS
echo "... ~/.zen/GPS ... $LAT $LON ..."
ville=$(my_IPCity)
echo "my_IPCity = $ville"
api_key="ac5e65a2fd10d3788d40cdae0d4516ba" # Remplacez YOUR_API_KEY par votre clé API OpenWeatherMap
url="http://api.openweathermap.org/data/2.5/weather?q=$ville&appid=$api_key&units=metric"
meteo=$(curl -s $url)
# Extraire les informations pertinentes de la réponse JSON
temperature=$(echo $meteo | jq -r '.main.temp')
description=$(echo $meteo | jq -r '.weather[0].description')
echo "La météo à $ville : $description, Température: $temperature °C"
## LOG IPFSNODEID : IPCity + Wheater + more...
${MY_PATH}/../tools/IPFSNODEID.weather.sh > ~/.zen/tmp/${IPFSNODEID}/weather.txt
## SHOW ZenStation FRONT
sed "s~_STATION_~${myIPFS}${ISTATION}/~g" $MY_PATH/../templates/ZenStation/index.html > ~/.zen/tmp/${MOATS}/index.htm

27
tools/IPFSNODEID.weather.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
########################################################################
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
## EXPLORE SWARM MAPNS
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
. "$MY_PATH/../tools/my.sh"
## GET IPFSNODEID WHEATER
source ~/.zen/GPS
echo "... ~/.zen/GPS ... $LAT $LON ..."
ville=$(my_IPCity)
echo "my_IPCity = $ville"
api_key="ac5e65a2fd10d3788d40cdae0d4516ba" # Remplacez YOUR_API_KEY par votre clé API OpenWeatherMap
url="http://api.openweathermap.org/data/2.5/weather?q=$ville&APPID=$api_key&units=metric"
meteo=$(curl -s $url)
# Extraire les informations pertinentes de la réponse JSON
temperature=$(echo $meteo | jq -r '.main.temp')
description=$(echo $meteo | jq -r '.weather[0].description')
echo "$ville : $description, ( $temperature °C )"
## SATELLITE IMAGE ...
## Add more +++

View File

@ -456,7 +456,7 @@ my_IPCity() {
local ville=$(echo "$geolocalisation" | jq -r '.city')
local pays=$(echo "$geolocalisation" | jq -r '.country')
echo "$ville, $pays"
echo "$ville,$pays"
}
IPFSNODEID="$(myIpfsPeerId)"