Switch to wttr.in for temperature, also include conditions.
This commit is contained in:
parent
c935968924
commit
18f2b55179
@ -22,7 +22,6 @@ ogg123 -q
|
|||||||
or
|
or
|
||||||
paplay
|
paplay
|
||||||
-c --nochime Turn off chimes.
|
-c --nochime Turn off chimes.
|
||||||
-k --key Your weatherstack.com api key. You can get one for free from weatherstack.com
|
|
||||||
-n --nospeak turn off spoken time.
|
-n --nospeak turn off spoken time.
|
||||||
-s --soundpack Set path to soundpack. Sound packs should be in ogg format and contain 1.ogg, 2.ogg, ... 11.ogg, 12.ogg and 15.ogg, 30.ogg, and 45.ogg for the quarter-hour chimes.
|
-s --soundpack Set path to soundpack. Sound packs should be in ogg format and contain 1.ogg, 2.ogg, ... 11.ogg, 12.ogg and 15.ogg, 30.ogg, and 45.ogg for the quarter-hour chimes.
|
||||||
-v --voice Select voice. Default is espeak other options are
|
-v --voice Select voice. Default is espeak other options are
|
||||||
|
@ -15,7 +15,6 @@ half-hour, 4 every quarter, and anything else will delete your existing settings
|
|||||||
-a --audio Command for playing sound. The default is play -q provided from the sox package.
|
-a --audio Command for playing sound. The default is play -q provided from the sox package.
|
||||||
-c --nochime Turn off chimes.
|
-c --nochime Turn off chimes.
|
||||||
-f --format: 12 or 24 hour format. Default is 12 hour time.
|
-f --format: 12 or 24 hour format. Default is 12 hour time.
|
||||||
-k --key: weatherstack.com api key. This is required for temperature and forecast. You can get a key for free.
|
|
||||||
-n --nospeak turn off spoken time.
|
-n --nospeak turn off spoken time.
|
||||||
-s --soundpack Set path to soundpack. Sound packs should be in ogg format and contain 1.ogg, 2.ogg, ... 11.ogg, 12.ogg and
|
-s --soundpack Set path to soundpack. Sound packs should be in ogg format and contain 1.ogg, 2.ogg, ... 11.ogg, 12.ogg and
|
||||||
15, 30, and 45.oggfor the quarter-hour chimes.
|
15, 30, and 45.oggfor the quarter-hour chimes.
|
||||||
@ -306,10 +305,6 @@ while [ $# -gt 0 ] ; do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"-k" | "--key")
|
|
||||||
shift
|
|
||||||
key="$1"
|
|
||||||
;;
|
|
||||||
"-n" | "--nospeak")
|
"-n" | "--nospeak")
|
||||||
speakTime="false"
|
speakTime="false"
|
||||||
;;
|
;;
|
||||||
@ -359,15 +354,14 @@ if [ "$speakTime" == "true" ] ; then
|
|||||||
timeString="${timeString} $(number_to_text $minute)"
|
timeString="${timeString} $(number_to_text $minute)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
#Add temperature if key is set
|
#Add temperature if zipcode is set
|
||||||
if [ -n "$key" ] ; then
|
if [ -n "$zipcode" ] ; then
|
||||||
temperature="$(curl -s "http://api.weatherstack.com/current?access_key=$key&query=${zipcode:-fetch:ip}&units=${units:-f}" | jq -r '.current.temperature')"
|
temperature="$(curl -s "https://wttr.in/${zipcode}?format=%t%20degrees%20and%20%C")"
|
||||||
if [ -n "$temperature" ] ; then
|
temp="${temperature//[^-[:digit:]]/}"
|
||||||
if [ "$format" = "24" ]; then
|
temperature="${temp} ${temperature#* }"
|
||||||
timeString="$timeString and $(number_to_text $temperature) degrees."
|
temperature="${temperature/-/Negative }"
|
||||||
else
|
if [ "${#temperature}" -ge 3 ] ; then
|
||||||
timeString="$timeString $(number_to_text $temperature) degrees."
|
timeString="$timeString. It is currently $temperature."
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
case "$voice" in
|
case "$voice" in
|
||||||
|
Loading…
Reference in New Issue
Block a user