Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Simple script to lookup Current weather from AccuWeather and send output to text-to-speak
- #Ideas found all over web
- #Stitched together by DigiGram (chris@digigram.za.net)
- #Checking dependencies
- command -v curl >/dev/null 2>&1 || { echo >&2 "Maybe try sudo apt-get install curl first"; }
- command -v grep >/dev/null 2>&1 || { echo >&2 "Maybe try sudo apt-get install grep first"; }
- command -v sed >/dev/null 2>&1 || { echo >&2 "Maybe try sudo apt-get install sed first"; }
- command -v espeak >/dev/null 2>&1 || { echo >&2 "Maybe try sudo apt-get install espeak first"; }
- command -v curl >/dev/null 2>&1 || { echo >&2 "Maybe try sudo apt-get install curl first"; }
- #Set these as you wish
- location="AF|ZA|FS|PARYS" #Zip code for US, Location code for International "AF|ZA|FS|PARYS"
- voice=mb-us1 #"sudo apt-get install mbrola-us1" (mb-us1) for female, "sudo apt-get install mbrola-us2" (mb-us2) for male. Others exist as well. Even 'n default one if you do not want to install mbrola
- cc='ZA' #two letter code of your country or state. Leave as XX if you don't want your Country to pe pronounced
- country='South Africa' #Your countries name, or what you would like to hear after your city name. Anything goes.
- #Done with settings. Sit back and enjoy
- #Get weather, parse output, say it out loud
- #If it seems to take forever, check your internet connection. If she just speaks to slow, increase -s
- curl -s --connect-timeout 30 http://rss.accuweather.com/rss/liveweather_rss.asp?metric=1\&locCode=$location | grep "Currently in" | sed 's/^[ \t]*<description>//' | sed 's/&.*;//' | sed 's/'"$cc"'/'"$country"'/' | espeak -v $voice -s165 -p45 -g3 >/dev/null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement