#!/usr/bin/perl
use CGI qw(escape -no_debug);
use File::Find;
# Base URL for files, no trailing slash
my $base="http://guymcarthur.com/resources/mp3";

sub wanted {
	# Only return files matching .MP3 .MP2 etc (case insensitive).
	return unless($_=~/\.mp\d$/i);
	# Remove the leading dot from the directory name.
	$File::Find::dir=~s/^\.//; 
	# Print the URL, escaping the filename.
	printf "$base%s/%s\n", $File::Find::dir, $cgi->escape($_);
	};

# Print the header for a WinAMP style URLList
$cgi=new CGI;
print $cgi->header(-type=>'audio/x-mpegurl',-expires=>'now');
# Find files using the subroutine "wanted" starting in the current directory.
find(\&wanted, '.');