ratox-nuggets

useful ratox related scripts
git clone git://git.2f30.org/ratox-nuggets
Log | Files | Refs | LICENSE

rat-weather-voice (776B)


      1 #!/bin/sh
      2 # Voice based weather oracle script
      3 
      4 #SYNTH="espeak --stdout"	# from espeak
      5 SYNTH=text2wave			# from festival
      6 
      7 tail -n0 -f text_out | while read line; do
      8 	address=${line:17:${#line}}     # strip off date time
      9 	echo "Predicting weather at $address. Wait a moment and pick up the call!.." > text_in
     10 	curl -s --get --data-urlencode "query=$address" \
     11 		http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml | \
     12 		perl -ne '/<title>([^<]+)/&&printf "%s: ",$1;/<fcttext>([^<]+)/&&print $1,"\n"' | \
     13 		perl -MHTML::Entities -pe 'binmode(STDOUT, ":encoding(utf8)"); decode_entities($_);' | \
     14 		perl -MHTML::Entities -pe 'binmode(STDOUT, ":encoding(utf8)"); decode_entities($_);' | \
     15 		$SYNTH | sox -t wav - -r 48000 -c 1 -e signed -b 16 -L -t wav - > call_in
     16 done