4 # Copyright (c) 2005 Dirk Koopman G1TLH
6 # Load all the spots you have into the spider.sdb SQLite
13 # root of directory tree for this system
15 $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
17 unshift @INC, "$root/perl"; # this IS the right way round!
18 unshift @INC, "$root/local";
28 my $dbh = DBI->connect("dbi:SQLite:dbname=$root/data/spider.sdb","","")
29 or die "cannot open $root/data/spider.sdb";
31 opendir DIR, "$root/data/spots" or die "No spot directory $!\n";
32 my @years = grep {/^\d/} readdir DIR;
35 $dbh->do("delete from spots");
37 my $sth = $dbh->prepare("insert into spots values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)") or die "prepare\n";
39 foreach my $year (@years) {
40 opendir DIR, "$root/data/spots/$year" or next;
41 my @days = grep {/^\d+\.dat/} readdir DIR;
43 my $j = Julian::Day->new(time);
49 printf "\rdoing $year %03d", $day;
50 my $fh = $Spot::fp->open($j); # get the next file
55 push @s, undef while @s < 14;