Weather Script

Richard Wells richwels at bupster.cjb.net
Tue Aug 26 17:19:36 EDT 2003


Hi Chris,

Will this script work if you have Festival installed instead of Flite or 
EFlite? I am running Red hat 8 and I would love to try your script if you 
think it would work wiht Festival.

Thanks for your response to what is probably a stupid question.

 On Tue, 26 
Aug 2003, Christopher Moore 
wrote:

> Hello Listers,
> A few days ago I posted a crude script for obtaining the current weather.
> Below is a revised version which allows you to enter either a zipcode or
> city, state.  The output is piped into the flite synthesizer.  If you don't
> have flite you can remove the it and have the output sent to the console.
> You can also change what info is spoken by modifying the awk program.  
> 
> Chris
> 
> ##### weather script below this line #####
> 
> #!/bin/sh
> #  The following script uses lynx to retrieve the 
> #  weather for the entered zipcode or city/state.
> #  A simple awk program selects the fields to be displayed.
> case $# in
>     0) echo "Usage:"
>        echo "    wx <zipcode>"
>        echo "  or" 
>        echo "    wx <city>,  <state>"
>        exit;;
>     1) query=$1;;
>     2) query=${1/%,}%2C+$2\";;
> esac
> lynx -dump http://braille.wunderground.com/cgi-bin/findweather/getForecast?query=${query}|\
> awk ' \
> /Updated:/ {u1 = $2; u2 = $3}
> /Observed/ {print $1, $2, $3, $4, "at", u1, u2} 
> /Temperature/ {t = $2
>     gsub(/[^[:digit:]]/, "", t)
>     print $1, t}
> /Humidity/ {print $1, $2} 
> /Dew Point/ {t = $3
>     gsub(/[^[:digit:]]/, "", t)
>     print $1, $2, t}
> /Wind/ {w = $2
>     if (length(w) <= 3) {
>         gsub(/N/, "North ", w)
>         gsub(/S/, "South ", w)
>         gsub(/E/, "East ", w)
>         gsub(/W/, "West ", w)
>     }
>     print $1, w, $3, $4}' | flite
> 
> _______________________________________________
> Speakup mailing list
> Speakup at braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
> 





More information about the Speakup mailing list