|
|
|
Målestasjonens siste timebilder.
|
De siste timebildene fra Hessdalen. Denne side blir oppdatert med et nytt bilde hver hele time.
#!/usr/bin/perl
#
# Copyright (c) 1997 Martin Ranang Thorsen
$cells = 28;
$format = '.jpg';
$meta_dir = "/hourlydir";
$thumb_dir = "/hourly_thumbdir";
$html_dir = "/ams".$meta_dir;
$html_thumb_dir = "/ams".$thumb_dir;
$hourly_dir = "/local/hessdalen/html".$html_dir;
$hourly_thumb_dir = "/local/hessdalen/html".$html_thumb_dir;
$tr = " | ";
sub print_http_header {
print "Content-type: text/html\n\n";
}
sub print_html_link {
my $file = @_[0];
my $year, $month, $day, $hour, $minute, $second;
($year, $month, $day, $hour, $minute, $second) = $file =~
/^hourly-(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$format$/;
print "\n";
print "";
print "![\"";](\"$html_thumb_dir/$file\") ";
print "Hourly $hour:$minute:$second $day.$month.$year";
print "\n";
print " | \n";
}
sub print_html_table {
print "\n$tr\n";
my $i, $file, @files;
opendir(DIR, "$hourly_thumb_dir") || die "Error: opening $alarm_thumb_dir.\n";
@files = reverse(sort(readdir(DIR)));
$i = 0;
foreach $file (@files) {
if(($file =~ /^hourly-\d{14}$\$format/) && ($i < $cells)) {
if(!($i % 4) && $i) {
print "\n$tr\n";
}
print_html_link($file);
$i++;
}
}
closedir(DIR);
print " \n";
}
print_http_header();
print_html_table();
exit(0)
|