#! /bin/bash

# get the web page for the latest IR satellite photo and extract the current 
# image name, then retrieve the image and set it as the background.
#
# Since the web page changes occasionally, the SATELLITE variable
# may need to be modified for it to work.

DIR=~/get_weather
#SATELLITE="GMS-5"
#SATELLITE="GOES-9"
SATELLITE="Australian Region"

IRIMAGE=$(wget -q -O - http://www.bom.gov.au/gms/IDE00005.latest.shtml | grep "$SATELLITE image" | awk -- '{split($0,a,"\""); print a[2]}')

rm $DIR/*.gif

wget -q -O $DIR/$IRIMAGE http://www.bom.gov.au/gms/$IRIMAGE

# now set the X background
#xsetbg -fillscreen $IRIMAGE
#/usr/X11R6/bin/xsetbg -display $DISPLAY -zoom 160 -onroot $DIR/$IRIMAGE
/usr/X11R6/bin/xsetbg -display $DISPLAY -zoom 200 -onroot $DIR/$IRIMAGE
