Last active
August 29, 2015 14:07
-
-
Save myroslav/6a8141538a263f647939 to your computer and use it in GitHub Desktop.
Weather ratox oracle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
tail -n0 -f text_out | while read line; do | |
address=${line:17:${#line}} # strip off date time | |
echo "Predicting weather at $address. Wait a moment and pick up the call!.." > text_in | |
curl -s --get --data-urlencode "query=$address" \ | |
http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml | \ | |
perl -ne '/<title>([^<]+)/&&printf "%s: ",$1;/<fcttext>([^<]+)/&&print $1,"\n"' | \ | |
perl -MHTML::Entities -pe 'binmode(STDOUT, ":encoding(utf8)"); decode_entities($_);' | \ | |
perl -MHTML::Entities -pe 'binmode(STDOUT, ":encoding(utf8)"); decode_entities($_);' | \ | |
text2wave | sox -t wav - -r 48000 -c 1 -e signed -b 16 -L -t wav - > call_in | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment