#!/bin/bash #xplanet-gnome.sh shell script v0.3 #shows Earth on your Gnome desktop with current lighting conditions,i.e. day and night #From: http://stef.tvk.rwth-aachen.de/~nazgul/linux-hacks.php #It also retrieves an updated cloudmap using clouds.pl script #From: cueSim Ltd. http://www.cueSim.com, Bedford, UK #Finally saves numbered secuential images to satisfy levhita's animation needs. #FROM: http://blog.levhita.net DELAY=15m PREFIX=/home/levhita/packages/xplanet/ APPEND=2 #Use .png for better quality, this is the one that'll be set as background EXT=.png GEOMETRY=1280x1024 #Default: Guadalajara, Jalisco. México. LONGITUDE=-103 LATITUDE=20 #Default is no projection,i.e. render a globe #rectangular is the flat world map. also try ancient, azimuthal, mercator,.. #PROJECTION=mercarto #Saves every render in date numbered file, default: no saving SAVE_SECUENCE=0 #Secuenced files prefix SECUENCED=secuence #To save some hard disk(around 10x magnitude) we convert the secuenced files to JPG #set to 0 to disable CONVERT_TO_JPG=1 #75 seems to be provide the best quality/size ratio (you are welcome to dissagre with me) JPG_QUALITY=75 #To save some more hard disk you can resize the image, remove for no resize. #Actually it only takes the second parameter, in order to mantain the aspect ratio. #i.e. when geometry is set to 1280x1024, # 800x600 goes to 750x600 # 640x480 goes to 600x480 RESIZE=800x600 #Enters installation dir cd $PREFIX while [ 1 ] do OUTPUT=xplanet #Retrieve the last avaliable cloudmap, only every 3 ours, used to avoid #bandwidth waste on the mirrors ./clouds.pl #rename background image so Gnome realises image has changed - thx to dmbasso if [ -e "$PREFIX$OUTPUT$EXT" ]; then rm "$PREFIX$OUTPUT$EXT" OUTPUT="$OUTPUT$APPEND" else rm "$PREFIX$OUTPUT$APPEND$EXT" fi if [ -z $PROJECTION ]; then xplanet -num_times 1 -output "$PREFIX$OUTPUT$EXT" -geometry $GEOMETRY -longitude $LONGITUDE -latitude $LATITUDE -config config.txt -fov .2 else xplanet -num_times 1 -output "$PREFIX$OUTPUT$EXT" -geometry $GEOMETRY -longitude $LONGITUDE -latitude $LATITUDE -projection $PROJECTION -config config.txt -fov .2 fi #update Gnome background gconftool -t str -s /desktop/gnome/background/picture_filename "$PREFIX$OUTPUT$EXT" #Saves and convert to JPG (if requested) the file in a date secuenced file if [ "$SAVE_SECUENCE" == "1" ]; then DATE=$(date +%Y%m%d%H%M%S) if [ "$CONVERT_TO_JPG" == "1" ]; then if [ -z $RESIZE ]; then mogrify -format jpg -quality $JPG_QUALITY% $PREFIX$OUTPUT$EXT else mogrify -resize $RESIZE -format jpg -quality $JPG_QUALITY% $PREFIX$OUTPUT$EXT fi mv $PREFIX$OUTPUT.jpg $PREFIX$SECUENCED$DATE.jpg echo "Converting and saving $PREFIX$SECUENCED$DATE.jpg" else cp "$PREFIX$OUTPUT$EXT" "$PREFIX$SECUENCED$DATE$EXT" echo "Saving $PREFIX$SECUENCED$DATE$EXT" fi fi sleep $DELAY done