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
|
||||
paplay
|
||||
-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.
|
||||
-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
|
||||
|
@ -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.
|
||||
-c --nochime Turn off chimes.
|
||||
-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.
|
||||
-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.
|
||||
@ -306,10 +305,6 @@ while [ $# -gt 0 ] ; do
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
"-k" | "--key")
|
||||
shift
|
||||
key="$1"
|
||||
;;
|
||||
"-n" | "--nospeak")
|
||||
speakTime="false"
|
||||
;;
|
||||
@ -359,15 +354,14 @@ if [ "$speakTime" == "true" ] ; then
|
||||
timeString="${timeString} $(number_to_text $minute)"
|
||||
fi
|
||||
fi
|
||||
#Add temperature if key is set
|
||||
if [ -n "$key" ] ; then
|
||||
temperature="$(curl -s "http://api.weatherstack.com/current?access_key=$key&query=${zipcode:-fetch:ip}&units=${units:-f}" | jq -r '.current.temperature')"
|
||||
if [ -n "$temperature" ] ; then
|
||||
if [ "$format" = "24" ]; then
|
||||
timeString="$timeString and $(number_to_text $temperature) degrees."
|
||||
else
|
||||
timeString="$timeString $(number_to_text $temperature) degrees."
|
||||
fi
|
||||
#Add temperature if zipcode is set
|
||||
if [ -n "$zipcode" ] ; then
|
||||
temperature="$(curl -s "https://wttr.in/${zipcode}?format=%t%20degrees%20and%20%C")"
|
||||
temp="${temperature//[^-[:digit:]]/}"
|
||||
temperature="${temp} ${temperature#* }"
|
||||
temperature="${temperature/-/Negative }"
|
||||
if [ "${#temperature}" -ge 3 ] ; then
|
||||
timeString="$timeString. It is currently $temperature."
|
||||
fi
|
||||
fi
|
||||
case "$voice" in
|
||||
|
Loading…
Reference in New Issue
Block a user