Created
April 14, 2015 19:11
-
-
Save lubosz/abfe18a4a2f0d6fd40ba to your computer and use it in GitHub Desktop.
display a weather gif in terminal
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
#!/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
Add terminal size autoscaling/detection: