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 zcmYc?2=nw+u+TGPU|?VnU|?`b%Z>YEeU7n6jDaB~F)tM)ObF*D6%^&`WfZ3v>Ln-Y zCFkcRCl;6J<)xOOX{-YosPB@WT$-DjS5mC+o>>xmZa%g@P-;285)3$P*ze@5EcprF-P%e2#kinXb6mk zz-S1JhQMeDjE2By2#kin2nm6b0!D^<1_lNusDG89G$R@f<&ILLAut*OqaiRF0;3@? z8UmvsFd71*Aut*OqaiRF0;3@?8UjNw1QJsi7~FUn7+�=Ko>+|2O;$46pea7_RU$ zFihoVU`XO;U`XU=V9@1fVEE3*z_5{zfnft514A_*14AYs14B9=1A_}61A`+U1A{Fe z1A{dm1A`SG1A`791A`VH1A`_X1A{sr1A`hL1A{al1A`zJ6vwW?ovpUS_^NScQU-oq~Q!YMFjsX-TGE(ytk`r@sQd2-aE6GSzfUbJi11*7vM+Qs_C?wLstKl>A(iM_R zi;7b7N)&SPlM_oa^YauE^HLO`@u8525NA+MEG@~%FS1f_Nz6-C2+z#P$xO^GW?)cO X)GsYA(of3F(@)JSQ%FiI&R_rlXi4w1 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