From 0d98d5d30b8f2b665f419ca4c67085835ab7baa6 Mon Sep 17 00:00:00 2001 From: Penelope Gwen Date: Wed, 19 Mar 2025 14:45:02 -0700 Subject: [PATCH] New backup 2025-03-19 14:45:02 --- de/home/.config/eww/scripts/widgets/weather | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/de/home/.config/eww/scripts/widgets/weather b/de/home/.config/eww/scripts/widgets/weather index 2825155..3e208f5 100755 --- a/de/home/.config/eww/scripts/widgets/weather +++ b/de/home/.config/eww/scripts/widgets/weather @@ -3,14 +3,15 @@ wttr_cache="${HOME}/.cache/wttr.json" if [[ ! $(find "${wttr_cache}" -cmin -60 -print 2>/dev/null) ]]; then -# echo "File ${wttr_cache} exists and is younger than 60min" -#else -# echo "File ${wttr_cache} does not exists or is younger than 60min" - curl --silent wttr.in/Eugene?format=j1 > "${wttr_cache}" + if ! ping -w 15 -c 1 wttr.in;then + exit + fi + wttr_json=$(curl --silent wttr.in/Eugene?format=j1) + if [ "" != "${wttr_json}" ]; then + echo "${wttr_json}" | tee "${wttr_cache}" + fi fi -#cat "${wttr_cache}" - condition="$(jq -r '.current_condition[0].weatherDesc[0].value' ${wttr_cache})" condition_code="$(jq -r '.current_condition[0].weatherCode' ${wttr_cache})" current_temp="$(jq -r '.current_condition[0].temp_F' ${wttr_cache})"