Add more recognizable icons and update only every 6 hours
This commit is contained in:
parent
242d564742
commit
95973d6533
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue