#!/usr/local/bin/perl

srand;

opendir(DIR,"midi/");
foreach (readdir(DIR)) {
	unless (/\.mid$/) { next; }
	if (/^t7g/) {
		@s = stat($_);
		if ($s[7] < 10240) { next; }
	}
	push @files, $_;
}
closedir(DIR);

$n = $#files;
$i = rand($n);
$file = $files[$i];
$path = 'midi/' . $file;

print "Content-type: text/html\n\n";

print "<EMBED SRC=\"$path\" width=143 height=60 autostart=true align=\"left\"</EMBED>
Visit WestNet's own <A HREF=\"midi/\">Spooky MIDI Archive</A>, featuring
files from USENET. Netscape users are currently listening to 
<A HREF=\"$path\">$file</a>, a random
selection from the archive.<br>
<br clear=\"left\">\n";

exit 0;
