From eac3e9167a2fae00c817e451bb9066d9b2433aae Mon Sep 17 00:00:00 2001 From: Dane Williams Date: Sat, 14 Mar 2020 19:21:31 -0700 Subject: [PATCH] added weather --- .weather.sh.swp | Bin 12288 -> 0 bytes dracula.tmux | 2 +- weather.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 55 insertions(+), 2 deletions(-) delete mode 100644 .weather.sh.swp diff --git a/.weather.sh.swp b/.weather.sh.swp deleted file mode 100644 index ee79d09c500bf41207af03c5bd4e8ad28c2c1114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI2L2DE-6o6knxk#-jRMg9BS8OZpq^+0IQbAZ14_<`oL9}Eu*_pshG9;O=5Rs(Gu4>o3Z?yj$`rV{3=d9H@j}5Q^Hoykh02^Qf zY=8~0f&b7zY-Zpco%>vO_Qh_VnVP$hCpN$a*Z><~18jf|umLu}2G{@_U;}L6KQth7 zfQPdHUx@Vo|MBntZ*u@&iOWA}@R9gH91w;mh#_&G*e14!P2vu5n^+;1 zh+D)B;u>+4m?!3lS>giGBhC}wyE7p@Unh950XDz}*Z><~18jf|umLu}2H3zq8mMb& zEcAVAF+E}K&7Ss1o!f<%HNYF_!2zVL<&_j2K%wJq)OB+dcMDy2_R(5zY@pYJo*Cl{ zEWB=T@WA1c*M)I*SGip8w!T`zmtFFy4JyzN?I=VO+o7S{wa-YCabyp*WS4m9efML>cw=&1FR;a1bz62~@^3 z#*STPoH%>~*YBao^`5Y8Rjq(BasQ7=>4m8r`b_0b6VU{uzIKaBR+Y}vmr+R9aM<;p zr55<#mvNkuOcaOR@WvKMXZ6%KkCjt0l3B*o~%P(wy|`66Nl7qkIzk28CeJF U`CSlg@M2`F&~^_;l3MJ40cc6@v;Y7A diff --git a/dracula.tmux b/dracula.tmux index c9a03e2..792eb80 100755 --- a/dracula.tmux +++ b/dracula.tmux @@ -44,7 +44,7 @@ main() tmux set-option -g status-right "#[fg=${dark_gray},bg=${pink}] #(~/.tmux/plugins/tmux-dracula/battery.sh) " tmux set-option -ga status-right "#[fg=${dark_gray},bg=${cyan}] tructus " - tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] flazen " + tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #(~/.tmux/plugins/tmux-dracula/weather.sh) " tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p #(date +%Z) " # window tabs diff --git a/weather.sh b/weather.sh index cfd02ea..4ab4867 100755 --- a/weather.sh +++ b/weather.sh @@ -5,11 +5,64 @@ #script is then called in the dracula.tmux program city=$(curl -s https://ipinfo.io/city 2> /dev/null) +region=$(curl -s https://ipinfo.io/region 2> /dev/null) +zip=$(curl -s https://ipinfo.io/postal 2> /dev/null | tail -1) +country=$(curl -s https://ipinfo.io/country 2> /dev/null) +region_code_url=http://www.ip2country.net/ip2country/region_code.html +weather_url=https://forecast.weather.gov/zipcity.php + +zip=46556 + +#substitute region code for regions in north america +get_region_code() +{ + curl -s $region_code_url | grep $region &> /dev/null && region=$(curl -s $region_code_url | grep $region | cut -d ',' -f 2) + echo $region +} + +weather_information() +{ + curl -sL $weather_url?inputstring=$zip | grep myforecast-current | grep -Eo '>.*<' | sed -E 's/>(.*)/dev/null; then + + echo "$(display_weather) $city, $(get_region_code)" + else + echo "Location Unavailable" + fi } #run main driver program