#!/usr/bin/perl
#################################################################################
#       Patrik Burkhalter,                                                      # 
#	Wed Apr 28 19:40:37 CEST 2004						#
#################################################################################
#                                                                               #
#   This program is free software; you can redistribute it and/or modify        #
#   it under the terms of the GNU General Public License as published by        #
#   the Free Software Foundation; either version 2 of the License, or           #
#   (at your option) any later version.                                         #
#                                                                               #
#   This program is distributed in the hope that it will be useful,             #
#   but WITHOUT ANY WARRANTY; without even the implied warranty of              #
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
#   GNU General Public License for more details.                                #
#                                                                               #
#   You should have received a copy of the GNU General Public License           #
#   along with this program; if not, write to the Free Software                 #
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   #
#                                                                               #
#################################################################################
# Changelog:
#
#


#
# Define x/y-coordinates
#
my $x     = -50;
my $y     = -100;
my $delta = +15;

#
# Path to File to write output
#
$UpdateFile = '/usr/local/xplanet/share/xplanet/markers/updatelabel';

#
# Files to check {'name'} = 'path'
#
$Files->{'Cloud Map from Meteosat'} = '/usr/local/xplanet/share/xplanet/images/clouds.jpg';
$Files->{'Satellite Information ISS'} = '/usr/local/xplanet/share/xplanet/satellites/iss.tle';
$Files->{'Satellite Information NEW'} = '/usr/local/xplanet/share/xplanet/satellites/new';
$Files->{'Satellite Information HST'} = '/usr/local/xplanet/share/xplanet/satellites/science';

#
# Updateheader
#
my $now = localtime(time());
$var = "$y $x \"Update File Last Updated: $now\" color=Green image=none position=pixel\n";

while ( my ($Name, $Filename) = each(%$Files) )
{
	$y   = $y + $delta;

	my $FileFound = false;
	# Get file details
	if(-f $Filename)
	{
		$FileFound = true;
		my @Stats = stat($Filename);
		my $FileDate = $Stats[9];
		#($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = 
		$date = localtime($FileDate);
	}

	#
	# Line to print
	#
	$var = $var . "$y $x \"$Name updated/checked @ $date\" color=Green image=none position=pixel\n";
}

#
#Title for the file
#
$output = '#'. $now . "\n" . $var;

open (FILEHANDLE, ">$UpdateFile") or die "no such file";
print FILEHANDLE $output;
close (FILEHANDLE);




