Updates to weather to make it much more powerful and accurate.

This commit is contained in:
Storm Dragon 2024-02-27 13:58:35 -05:00
parent 18f2b55179
commit f2d1fafc94
2 changed files with 8 additions and 2 deletions

View File

@ -31,7 +31,11 @@ To set a custom voice enter the command as in:
-v 'espeak -v en-us+klatt2'
Note that rhvoice requires a - followed by the voice name you want, for example, rhvoice-bdl or rhvoice-alan.
zipcode and flite_time are incompatable. If you have zipcode set the temperature will not be read while using flite_time.
-z --zipcode Postal code: Will speak the temperature along with the time so long as you do not have nospeak set. E.G. -z 90210.
-z --zipcode Postal code: Will speak the temperature along with the time so long as you do not have nospeak set. E.G. -z 90210. With a recent change in the weather provider, you can now use airport codes, or the name of a location, remember to put anything with spaces in quotes, so zipcode="city state". Also, postal codes seem to be less reliable than location names or airport codes. For more information on what types of locations are accepted, run the following command:
curl https://wttr.in/:help
Although zipcode should more accurately be called location, the old zipcode is kept for compatibility. With the new changes, it is much more powerful and accurate.
talking clock can also read settings from the following files?
/etc/talking-clockrc global settings
@ -45,7 +49,7 @@ sound=play -q
soundpack=/home/USER/thunderstorm
chime=true
speak=true
zipcode=90210
zipcode="Raleigh North Carolina"
Soundpack should be the path to a directory. Do not include the trailing / talking-clock adds it for you.
voice=espeak -v en-us+klatt2 -s 300
Be careful when using custom voice commands, if it is not valid the program will not work. You do not have to specify parameters for voice commands if you want to use the defaults. You can use voice=espeak (this is the default), voice=cepstral, voice=speech-dispatcher, voice=rhvoice-bdl, or voice=festival.

View File

@ -356,6 +356,8 @@ if [ "$speakTime" == "true" ] ; then
fi
#Add temperature if zipcode is set
if [ -n "$zipcode" ] ; then
zipcode="${zipcode//[[:space:]]/+}"
zipcode="${zipcode#ip}"
temperature="$(curl -s "https://wttr.in/${zipcode}?format=%t%20degrees%20and%20%C")"
temp="${temperature//[^-[:digit:]]/}"
temperature="${temp} ${temperature#* }"