Updated to a more reliable weather service for talking-clock.
This commit is contained in:
@ -15,6 +15,7 @@ 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.
|
||||
@ -22,7 +23,6 @@ half-hour, 4 every quarter, and anything else will delete your existing settings
|
||||
cepstral, espeak, festival, gama_tts, pico, sam, speech-dispatcher and custom.
|
||||
To set a custom voice enter the command as in:
|
||||
-v 'espeak -v en-us+klatt2'
|
||||
-t --torify retrieve temperature anonymously using torify, used with -z --zipcode
|
||||
-z --zipcode postal code Used for current temperature, may not be available inn all areas.
|
||||
For complete information read the README located at /usr/share/talking-clock/README"
|
||||
EOF
|
||||
@ -305,12 +305,13 @@ while [ $# -gt 0 ] ; do
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
"-k" | "--key")
|
||||
shift
|
||||
key="$1"
|
||||
;;
|
||||
"-n" | "--nospeak")
|
||||
speakTime="false"
|
||||
;;
|
||||
"-t" | "--torify")
|
||||
torify="true"
|
||||
;;
|
||||
"-c" | "--nochime")
|
||||
chime="false"
|
||||
;;
|
||||
@ -357,13 +358,9 @@ if [ "$speakTime" == "true" ] ; then
|
||||
timeString="${timeString} $(number_to_text $minute)"
|
||||
fi
|
||||
fi
|
||||
#Add temperature if zipcode is set
|
||||
if [ -n "$zipcode" ] ; then
|
||||
if [ "$torify" == "true" ] ; then
|
||||
temperature="$(torify curl -s "http://wttr.in/$zipcode?T0" | grep -m 1 -Eo -e '-?[[:digit:]].*[CF]' | cut -d ' ' -f1 | sed 's/.*-//')"
|
||||
else
|
||||
temperature="$(curl -s "http://wttr.in/$zipcode?T0" | grep -m 1 -Eo -e '-?[[:digit:]].*[CF]' | cut -d ' ' -f1 | sed 's/.*-//')"
|
||||
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 '.current.temperature')"
|
||||
if [ -n "$temperature" ] ; then
|
||||
if [ "$format" = "24" ]; then
|
||||
timeString="$timeString and $(number_to_text $temperature) degrees."
|
||||
|
Reference in New Issue
Block a user