";
print OUT "$artist
$title
";
print OUT "\n";
#write out the song titles
for (0..$#songsarray) {
my @mp3match="";
my @mp3match1 = grep /\Q$songsarray[$_]\E/i, @mp3files;
my @mp3match = grep /$artist/i,@mp3match1;
print OUT "\n",$_+1,". | \n";
print OUT "";
if (@mp3match){
print OUT "$songsarray[$_]";
my $MP3=' (mp3)';
}else{
print OUT "$songsarray[$_]";
}
print OUT " | \n";
print OUT "$timesarray[$_] |
\n";
}
print OUT " | | -------- |
";
printf OUT (" | | %02d:%02d |
",$minutes,$seconds);
print OUT "
\n";
print OUT "$footer";
close OUT;
$TOC{$filename}="$artist2 $songlink $MP3";#add Genre Here
}
close IN;
#########################################
print "Writing Table of contents file...\n";
open TOCFILE, ">$dboutdir/TOC.htm" or die "Cannot open $dboutdir/TOC.htm for write :$!";
print TOCFILE "$header\n";
print TOCFILE "0to9 ";
for('a'..'z'){
print TOCFILE "$_ ";
}
print TOCFILE "All";
print TOCFILE "
".(keys %TOC)." Albums
";
print TOCFILE "Generated via Perl script on
".scalar localtime()."
";
close TOCFILE;
#########################################
print "Printing Alphabetical Sort...\n";
for ('a'..'z'){
open LETTERFILE, ">$dboutdir/$_.htm" or die "Cannot open $dboutdir/$_.htm for write :$!";
print LETTERFILE "$header";
print LETTERFILE "$_
";
foreach $key (sort keys %TOC){
if($key=~/^$_/){
print LETTERFILE "$TOC{$key}
\n";
}
}
print LETTERFILE "$footer";
close LETTERFILE;
}
######################################
open ALLFILE, ">$dboutdir/all.htm" or die "Cannot open $dboutdir/all.htm for write :$!";
open NUMFILE, ">$dboutdir/0to9.htm" or die "Cannot open $dboutdir/0to9.htm for write :$!";
print ALLFILE $header;
print NUMFILE $header;
print ALLFILE "All
\n";
print NUMFILE "0to9
\n";
foreach $key (sort keys %TOC){
if ($key=~/^\d/){
print NUMFILE "$TOC{$key}
\n";
}
print ALLFILE "$TOC{$key}
\n";
}
print ALLFILE "$footer";
print NUMFILE "$footer";
close ALLFILE;
close NUMFILE;
######################################
#Write the MP3 listing page
@mp3files=sort @mp3files;
open OUT6, ">$dboutdir/mp3list.htm" or die "Cannot open $dboutdir/mp3list.htm for write :$!";
print OUT6 "$header";
print OUT6 "MP3 Listing ($#mp3files files)
\n";
foreach (@mp3files){
print OUT6 "$_
\n";
}
print OUT6 "$footer";
close OUT6;
######################################