#!/usr/bin/perl # http://riverdrift.com/ 2004 # Install in any directory with music files # name whatever.pl and chomod to 755 # Edit variables below as you wish ########################################## # page title $title='Audio File Lister'; # background color $bgc='#336666'; # text color $txtclr='#99ff66'; # link color $lnkclr='#66ffcc'; # vlink color $vlnkclr='#66cccc'; # font size $fntsze='14pt'; ########################################## $root = $ENV{'SERVER_NAME'}; $script = $ENV{'SCRIPT_NAME'}; $dir = `pwd`; @Files = `ls $dir`; print "Content-type: text/html\n\n"; print qq~ $title

$title

    \n~; $dirname = `dirname $script`; chomp($dirname); foreach (sort @Files) { chomp; &file_size; if (m/(mid|mid.gz|au|wav|mod)$/i) { if ($dirname) { $ht = $dirname; } else { $ht = '';} print qq~
  1. $_......$size~;
  2. } } print qq~
~; exit; sub file_size { $size = (-s); if ($size > 1000000) { $size = sprintf('%.2f', $size / 1000000) . ' meg'; } elsif ($size > 1000) { $size = sprintf('%.1f', $size / 1000) . ' kb'; } else { $size .= ' bytes'; } }