check for cache dir before wttr
This commit is contained in:
parent
c45f6fbafc
commit
5b6df3bb57
1 changed files with 14 additions and 10 deletions
|
@ -54,6 +54,8 @@ DISPSTAT="$E$L"
|
||||||
|
|
||||||
# weather (https://github.com/chubin/wttr.in)
|
# weather (https://github.com/chubin/wttr.in)
|
||||||
# add %l for location
|
# add %l for location
|
||||||
|
if [ -d ~/.cache/thrrgilag ];
|
||||||
|
then
|
||||||
WCACHE=~/.cache/thrrgilag/wttr
|
WCACHE=~/.cache/thrrgilag/wttr
|
||||||
if [ ! -f $WCACHE ];
|
if [ ! -f $WCACHE ];
|
||||||
then
|
then
|
||||||
|
@ -63,9 +65,11 @@ AGE=$(($(date +%s) - $(stat -c '%Y' "$WCACHE")))
|
||||||
if [ $AGE -gt 1800 ] || [ ! -s $WCACHE ];
|
if [ $AGE -gt 1800 ] || [ ! -s $WCACHE ];
|
||||||
then
|
then
|
||||||
curl -s en.wttr.in/?format="%l+%t+%C+%h+%w+%m" > $WCACHE
|
curl -s en.wttr.in/?format="%l+%t+%C+%h+%w+%m" > $WCACHE
|
||||||
#echo "-" > $WCACHE
|
|
||||||
fi
|
fi
|
||||||
WEATHER=$(cat $WCACHE)
|
WEATHER=$(cat $WCACHE)
|
||||||
|
else
|
||||||
|
WEATHER=""
|
||||||
|
fi
|
||||||
|
|
||||||
# spotify
|
# spotify
|
||||||
MCLASS=$(playerctl metadata --player=spotify --format '{{lc(status)}}')
|
MCLASS=$(playerctl metadata --player=spotify --format '{{lc(status)}}')
|
||||||
|
|
Loading…
Reference in a new issue