Add more recognizable icons and update only every 6 hours

This commit is contained in:
Alex 2020-05-22 01:15:13 +02:00
parent 242d564742
commit 95973d6533
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 13 additions and 13 deletions

View File

@ -31,30 +31,30 @@ function prompt_weather() {
# Fancy stuff
local -A icons
local -A colors
icons[c]=''
icons[c]=''
colors[c]="yellow"
icons[lc]=''
icons[lc]=''
colors[lc]="yellow"
icons[hc]=''
icons[hc]=''
colors[hc]="cyan"
icons[s]=''
colors[s]="cyan"
icons[lr]=''
icons[s]='🌢'
colors[s]="yellow"
icons[lr]='🌢'
colors[lr]="cyan"
icons[hr]=''
colors[hr]="cyan"
icons[t]=''
icons[hr]=''
colors[hr]="blue"
icons[t]=''
colors[t]="white"
icons[h]=''
colors[h]="blue"
icons[sl]=''
icons[h]=''
colors[h]="white"
icons[sl]=''
colors[sl]="blue"
icons[sn]=''
colors[sn]="white"
if [ ! -v _cprompts_weather ]; then
zstat -A stats +mtime -- $tmpfile 2>/dev/null
if [[ $stats[1] < $(($epochtime[1]-360)) ]]; then
if [[ $stats[1] < $(($epochtime[1]-21600)) ]]; then
local result=$(curl -sL https://www.metaweather.com/api/location/${_cprompts_weather_loc:-1339615}/ | jq -e '.consolidated_weather[0] | {"temp": .the_temp, "icon": .weather_state_abbr}')
if [ ! -z $result ]; then
local ico=$(print $result | jq -r '.icon')