#!/usr/bin/perl
open(MODES,"localcopy/modes.dat") || die("modes.txt not found.");
sub table_heading {
print "
\n";
if ($direction ne "Beacon") {
print " Downlink | ";
print "Satellite | ";
print " Uplink | ";
} else {
print " Frequency | ";
print "Satellite | ";
}
print "
\n";
}
sub table_entry {
return " $_[0] | ";
}
$/ = "\n";
while ($line = ) {
$line =~ s|\:*[\s\t]\s*| |g;
$line =~ s|\s$||;
($key,@rest) = split(" ",$line);
($m1,$m2,$f1,$f2,$bandwidth,$dir) = @rest;
if ($key eq "Satellite") {
if ($line =~ m/STS-/ || $line =~ m/Soyuz TM/) {
last;
}
$satellite = join(" ",@rest);
$object = $satellite;
$index = 0;
} elsif ($key eq "Alias") {
$alias = join(" ",@rest);
if (length($object)>length($alias) && $alias =~ m/-/) {
$object = $alias;
}
$object =~ s/Phase 3/Phase 3/;
} elsif ($key eq "Frequency") {
++$index;
$key = "$object \#$index";
if (!$dir) {
$downlink{$key} = "$f1 $m1";
} else {
$downlink{$key}
= ($f1-$bandwidth/2000)."-".($f1+$bandwidth/2000)." $m1";
}
if ($m2 ne "NONE") {
if (!$dir) {
$uplink{$key} = "$f2 $m2";
} else {
$uplink{$key}
= ($f2-$bandwidth/2000)."-".($f2+$bandwidth/2000)." $m2";
}
}
}
}
@downlinks
= sort { ($downlink{$a} <=> $downlink{$b})
|| $uplink{$a} <=> $uplink{$b}
|| $a cmp $b
} keys(%downlink);
@uplinks
= sort { $uplink{$a} <=> $uplink{$b}
|| $downlink{$a} <=> $downlink{$b}
|| $a cmp $b
} keys(%uplink);
if ($ENV{"QUERY_STRING"} =~ m/uplink/i) {
$direction = "Uplink";
@tail = @uplinks;
} elsif ($ENV{"QUERY_STRING"} =~ m/beacon/i) {
$direction = "Beacon";
@tail = @downlinks;
} else {
$direction = "Downlink";
@tail = @downlinks;
}
#
# Tell the other end that we're sending HTML
#
print "Content-type: text/html\r\n\r\n";
print "Amateur Satellites by $direction Frequency";
print "Amateur Satellites by $direction Frequency
\n";
print "";
print "Data courtesy of Dr. Manfred Bester, Bester Tracking Systems, P.O. Box 9948, Berkeley, CA 94709
\n";
print "";
&table_heading();
while (@tail) {
$object = $tail[0];
shift @tail;
($satellite,$index) = split(" ",$object);
($f1,$mode1) = split(" ",$downlink{$object});
($f2,$mode2) = split(" ",$uplink{$object});
if (!($object =~ m/SARA/ # Huh?
|| $object =~ m/SEDSAT/ # Not up yet
|| $object =~ m/UNAMSAT-1/ # Not up yet, also duplicate alias?
|| $object =~ m/AO-21/ # R.I.P.
|| $object =~ m/GPS/ # They're all the same anyway
|| $object =~ m/Glonass/ # I'm not sure why Bester has this.
|| ($f2 && $direction eq "Beacon"))) {
if ($direction eq "Uplink") {
$this = $f2;
} else {
$this = $f1;
}
if (int($this/10) != int($lastfreq/10) && $lastfreq < 1000
&& $lastfreq) {
print "
\n";
&table_heading();
}
print "".&table_entry($f1).&table_entry($mode1)
.&table_entry($satellite);
if ($f2) {
print &table_entry($f2).&table_entry($mode2)."
\n";
} elsif ($direction ne "Beacon") {
print " -- | \n";
}
$lastfreq = $this;
}
}
print "
\n";
print "Notes:";
print "- FM Uplink and USB downlink is generally 1200 bps packet.\n";
print "
- Except MIR and AO-27, most FM is 9600 bps packet.\n";
print "
- P3D stands for Phase 3D, which was scheduled for launch in April 1997 when the program which generates this was last updated. (There is a 5.6 GHz uplink as well as 10 GHz and 24 GHz analog downlinks not shown above.)\n";
print "
- For Phase 3D digital frequencies, please see AMSAT's Phase 3D frequency listing.\n";
print "
\n";