#!/bin/bash # #Text to speech hazardous weather check and report script #by: kb9mwr # # ########## #Clean Up# ########## /bin/rm -f /tmp/2dayhwo.txt > /dev/null 2>&1 /bin/rm -f /tmp/hwodata.txt > /dev/null 2>&1 # ############### # Get the Data# ############### wget http://weather.noaa.gov/pub/data/raw/fl/flus43.kgrb.hwo.grb.txt -O /tmp/hwodata.txt > /dev/null 2>&1 # # #Theory: #Step one pull the report hourly with cron? # #This seems to be the URL to check for severe statements for GB: # #http://weather.noaa.gov/pub/data/raw/fl/flus43.kgrb.hwo.grb.txt # #An old report: #http://web.archive.org/web/20030225100856/http://weather.noaa.gov/pub/data/raw/fl/flus43.kgrb.hwo.grb.txt # #Step two determine between which two line numbers is important to #announce for today. Lines start with .DAY # STARTLINE=`grep ".DAY" -n /tmp/hwodata.txt | head -2 | cut -c1-2 | head -1` STARTLINE=$(($STARTLINE+1)) ENDLINE=`grep ".DAY" -n /tmp/hwodata.txt | head -2 | cut -c1-2 | tail -1` DIFF=$(($ENDLINE-$STARTLINE)) # #Is there even any hazardous WX? ANY=`more +$STARTLINE /tmp/hwodata.txt | head -1 | cut -c1-2` # if [ $ANY = "NO" ]; then echo "There is none, exiting...." ; exit 0 fi # #################################################### # Else If There Is Lets Create What We Want To Say # #################################################### echo "Here Is The Hazardous Weather Outlook For North East Wisconsin" >> /tmp/2dayhwo.txt echo "For Today and Tonight" >> /tmp/2dayhwo.txt more +$STARTLINE /tmp/hwodata.txt | head -$DIFF >> /tmp/2dayhwo.txt # ############# #Debug Stuff# ############# ##echo "Read between lines $STARTLINE and $ENDLINE the difference is $DIFF" ##cat /tmp/2dayhwo.txt # ############ # Speak It # ############ /usr/bin/festival --tts /tmp/2dayhwo.txt #/opt/swift/bin/swift -f /tmp/2dayhwo.txt # exit 0