Skip to content

Instantly share code, notes, and snippets.

@benlights
Forked from lubosz/weather.sh
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benlights/5706f7de1d056cd3c2fc to your computer and use it in GitHub Desktop.
Save benlights/5706f7de1d056cd3c2fc to your computer and use it in GitHub Desktop.
#!/bin/sh
DOWNLOAD_DIR=~/Downloads/weather
REGION=txgulf
# make download dir if not available
if [ ! -d "$DOWNLOAD_DIR" ]; then
mkdir -p $DOWNLOAD_DIR
fi
# set loop counter
COUNTER=0
# remove old files
rm -rf $DOWNLOAD_DIR/*.gif
rm -rf $DOWNLOAD_DIR/*.txt
rm -rf $DOWNLOAD_DIR/*.png
# replace URL with your region
wget -P $DOWNLOAD_DIR "http://archive.wfaa.com/weather/images/core/animated-loops/comp/880x495/${REGION}_anim.gif"
#rename file to map.gif
mv $DOWNLOAD_DIR/*.gif $DOWNLOAD_DIR/map.gif
# expand gif and convert to png
convert -coalesce $DOWNLOAD_DIR/map.gif $DOWNLOAD_DIR/map.png
# display extracted images as ASCII
for i in `ls $DOWNLOAD_DIR/map-*`; do
img2txt -W 75 -H 30 $i > $i.txt
done
while [ $COUNTER -lt 5 ] ; do
for i in `ls $DOWNLOAD_DIR/map-*.txt`; do
clear
cat $i
sleep 0.5
done
let COUNTER=COUNTER+1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment