Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- # Grab the local forecast from NOAA
- # Find the first line that matters (TODAY || TONIGHT)
- # Figure out what line it is, and pull out just the bit I care about (today and tomorrow)
- # Convert to MP3 for a Logitech Squeezebox to play with one button press
- # Marvel at how close this looks like my crappy Perl code
- cd /home/bobd/scripts/weather
- rm nmz211.txt*
- rm localweather.mp3
- rm /home/plex/weather/localweather.mp3
- declare -i STARTLINE
- export CUTOFF=`date --date="1 days tomorrow" +"%A" | tr '[:lower:]' '[:upper:]'`
- wget https://tgftp.nws.noaa.gov/data/forecasts/zone/nm/nmz211.txt
- export STARTLINE="`sed -n '/\./{=;q;}' nmz211.txt`"
- tail -n +$STARTLINE nmz211.txt | sed 's/^\.//' | sed -n "/$CUTOFF/q;p" > current.txt
- espeak -f current.txt --stdout | ffmpeg -i - -ar 44100 -ac 2 -ab 192k -f mp3 localweather.mp3
- ffmpeg -i localweather.mp3 -i logo.png -map 0:0 -map 1:0 -c copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" /home/plex/weather/localweather.mp3
- rm current.txt
Advertisement
Add Comment
Please, Sign In to add comment