diff options
Diffstat (limited to 'nws')
| -rwxr-xr-x | nws | 30 |
1 files changed, 22 insertions, 8 deletions
@@ -1,4 +1,6 @@ #!/bin/bash +# nws - a National Weather Service terminal client +# git.slickd.xyz/nws source ~/.config/nws.conf @@ -9,7 +11,7 @@ colors() { } cleanup() { - rm -rf ~/.cache/.county_ids ~/.cache/.weather_forecast ~/.cache/.weather_alerts + rm -rf ~/.cache/.county_ids ~/.cache/.weather_forecast ~/.cache/.weather_alerts /tmp/nws/ } retrieve_counties() { @@ -39,10 +41,6 @@ show_full_radar() { mpv --loop-file=inf "https://radar.weather.gov/ridge/standard/CONUS_loop.gif" } -show_timing() { - mpv --loop-file=inf "https://www.weather.gov/images/${area2}/graphicast/image6.png" -} - show_alerts() { colors curl -s "https://api.weather.gov/alerts/active/zone/${countyId}" >> ~/.cache/.weather_alerts @@ -89,6 +87,22 @@ show_spc() { mpv --loop-file=inf "https://www.spc.noaa.gov/products/activity_loop.gif" } +get_graphicast() { + mkdir -p /tmp/nws/ + count=1 + prog=12.5 + bar="#" + while [ $count -le 8 ] + do + wget -q -P /tmp/nws https://www.weather.gov/images/oun/graphicast/image${count}.png + echo -ne "${bar} (${prog}%)\r" + ((count++)) + prog=$(echo "$prog + 12.5" | bc) + bar="${bar}#" + done + $IV /tmp/nws/* +} + get_forecast() { colors get_location @@ -120,10 +134,10 @@ help() { echo " --spc: shows storm predictions" echo " --retrieve-counties: shows county ids" echo " --ca: shows number of alerts" + echo " --gc: shows graphic forecast, uses image viewer set in config" echo " -a: shows alerts" echo " -f: shows local forecast" } - cleanup case $1 in "--full-radar") show_full_radar;; @@ -131,9 +145,9 @@ case $1 in '--spc') show_spc;; '--retrieve-counties') retrieve_counties;; '--ca') count_alerts;; - '-t') show_timing;; + '--gc') get_graphicast;; '-a') show_alerts | sed 's/null//g ; s/"//g' |less -R;; - '-f') get_forecast | sed 's/"//g' | less -R;; + '-f') get_forecast | sed 's/"//g ; s/null/0/g' | less -R;; '-h') help;; "") help;; esac |