#!/usr/bin/perl -w #use strict; foreach $archiveFile (<*.m3u>) { $archiveFileNo = substr($archiveFile, 8, 4); $backup = "tempfile.swap"; open (TEMP, ">$backup") or die "cant create bak"; open (PLAYLIST, "$archiveFile") or die "cant find $archiveFile"; foreach $line () { if ($line =~ /\#EXT/) { print TEMP "$line"; }elsif ($line =~ /Archive\b/) { ($crap, $rest) = split( /Archive/, $line); if($crap){}; print TEMP "Archive$rest"; }else { print TEMP "Archive$archiveFileNo $line"; } } open (TEMP, "$backup") or die "cant create bak"; open (PLAYLIST, ">$archiveFile") or die "cant find $archiveFile"; foreach $line () { print PLAYLIST "$line"; } #open (TEMP, ">$backup") or die "cant create bak"; } #this prog chops up ne playlist called recent.m3u into another file called traklist.mjb #open (PLAYLIST, "recent.m3u") or die "cant find recent.m3u"; open (ARCHTABLE, ">archtable.html") or die "couldn't create web page archtable.html"; $bigoutfile = "bigtable.html"; print ARCHTABLE" Archives "; $oldalbum = "shshg"; $oldarch = "gfdshgh"; $albumlength = 0;#3298; $firsttime = 1; $archlength = 0; print "Working"; my @matt; foreach $file (<*.m3u>) { open (PLAYLIST, $file) or die "cant find recent.m3u"; foreach $line () { chomp($line); #$line =~ s/\(//; #$line =~ s/\)//; if ($line =~ /EXTINF/i) { ($length,$temp) = split(/\,/,$line); ($temp,$length) = split(/:/,$length); $secs = $length % 60; $mins = ($length - $secs) / 60; $totsecs = $length; if ($secs < 10) { $secs = "0".$secs; } $length = $mins.":".$secs; }elsif($line =~ /EXTM3U/i){ }elsif($line eq ""){ #if top line or blank then, do nothing }else{ ($arch,$rest) = split(/\\/,$line,2); if ((index($rest,"The ")) == 0) { substr($rest,0,4) = ""; } $firstchar = substr($rest, 0, 1); $firstchar =~ tr/a-z/A-Z/; substr($rest, 0, 1) = $firstchar; $line = $rest."|".$arch."|".$length; ($artist,$album,$title) = split(/\\/, $rest); if ($album =~ /mp3/) { $title = $album; $album = $artist; } $artandalb = $artist.$album; $artandalb =~ s/ //g; $art = $artist; $art =~ s/ //g; $archanc = $arch; $archanc =~ s/ //g; $firstchar = substr($album, 0, 1); $firstchar =~ tr/a-z/A-Z/; substr($album, 0, 1) = $firstchar; if ($arch ne $oldarch) { $secs = $archlength % 60; $totmins = ($archlength - $secs) / 60; $mins = $totmins % 60; $hours = ($totmins - $mins) / 60; $archlength = $hours." hours, ".$mins." minutes and ".$secs." seconds"; if (!($firsttime)){ $secs = $albumlength % 60; $mins = ($albumlength - $secs) / 60; if ($secs < 10) { $secs = "0".$secs; } my $talbumlength = $mins.":".$secs; print ARCHTABLE " $talbumlength
$oldarch is $archlength of solid music!! "; } print ARCHTABLE"

$arch

"; $archlength = 0; } if($album ne $oldalbum) { print "."; $archlength = $archlength + $albumlength; $secs = $albumlength % 60; $mins = ($albumlength - $secs) / 60; if ($secs < 10) { $secs = "0".$secs; } $albumlength = $mins.":".$secs; if (!(($firsttime))&&($arch eq $oldarch)){ print ARCHTABLE " "; } print ARCHTABLE " "; $albumlength = $totsecs; }else{ $albumlength = $albumlength + $totsecs; } $firsttime = 0; $oldalbum = $album; $oldarch = $arch; @matt = (@matt,$line); } } close PLAYLIST; } $secs = $archlength % 60; $totmins = ($archlength - $secs) / 60; $mins = $totmins % 60; $hours = ($totmins - $mins) / 60; $archlength = $hours." hours, ".$mins." minutes and ".$secs." seconds"; $secs = $albumlength % 60; $mins = ($albumlength - $secs) / 60; if ($secs < 10) { $secs = "0".$secs; } $albumlength = $mins.":".$secs; if (!($firsttime)){ print ARCHTABLE "
Artist Album Album length
$albumlength
$artist $album$albumlength

$oldarch is $archlength of solid music!! " ; } @matt = sort @matt; my $lastfoundalbum = ""; my $lasttrack = ""; foreach (@matt) { ($rest,$arch,$length) = split(/\|/,$_,3); $_ = $arch."\\".$length."\\".$rest; @fun = (@fun,"$_\n"); ($artist,$album,$title) = split(/\\/, $rest); if ( ($_ eq $lasttrack) && ($album ne $lastfoundalbum) ){ print "\nWARNING, These albums are already in your collection : *** ".$album; $lastfoundalbum = $album; $lasttrack = ""; } $lasttrack = $_; } print "Stage 1 was sucessful!\n"; #this prog takes traklist.mjb and creates albumtable.html and bigtable.html $bigoutfile = "bigtable.html"; open (HTMLOUT, ">albumtable.html") or die "couldn't create web page albumtable.html"; open (PRINTOUT, ">printtable.html") or die "couldn't create web page printtable.html"; open (BIGHTMLOUT, ">bigtable.html") or die "couldn't create web page bigtable.html"; print HTMLOUT" Matts Albums - www.invite.4t.com

Matts Albums - www.invite.4t.com

"; print PRINTOUT" Matts Albums - www.invite.4t.com - easy print list

Matts Albums - www.invite.4t.com

Artist Album Archive
"; print BIGHTMLOUT" Matts Trax

Matts Albums



"; $album = "EXT"; $oldalbum = "matt"; $firsttime = 1; print "Working." ; my $archivenumber; my $line; #open (GOODPLAYLIST, "traklist.mjb") or die "cant find traklist.mjb"; #while( $line = ()) { foreach $line (@fun) { #print"@fun"; #print "$line"; chomp($line); #$line =~ s/\(//g; #$line =~ s/\)//g; ($archivenumber,$length,$artist,$album,$title) = split(/\\/, $line); if ($album =~ /mp3/) { $title = $album; $album = $artist; } $artandalb = $artist.$album; $artandalb =~ s/ //g; $art = $artist; $art =~ s/ //g; $archanc = $archivenumber; $archanc =~ s/ //g; $firstchar = substr($album, 0, 1); $firstchar =~ tr/a-z/A-Z/; substr($album, 0, 1) = $firstchar; if ($firsttime) { $oldalbum = $album; print HTMLOUT"
"; print PRINTOUT""; print BIGHTMLOUT "
Artist Album Archive
$artist $album
$archivenumber
$artist $album
$archivenumber

$artist - $album - $archivenumber

"; } if($album eq $oldalbum) { print BIGHTMLOUT " "; }else { print "."; print HTMLOUT " "; print PRINTOUT " "; print BIGHTMLOUT "
Track Length
$title $length
$artist $album
$archivenumber
$artist $album
$archivenumber

$artist - $album - $archivenumber

"; } $firsttime = 0; $oldalbum = $album; $line = ""; } print HTMLOUT "
Track Length
$title $length

Click
here to see a complete list of everything."; print BIGHTMLOUT "
Click here to see a simple list of albums."; print "Stage 2 was sucessful!\n";