#!/usr/bin/perl # tiny little script to generate a url for an icecast stream. # $Id: genmpegurl.m3u,v 1.1 2000/07/15 02:28:01 steev Exp $ # this is meant to be run as an apache handler. give it a # mp3 file with .m3u onthe end instead of mp3, and it will send the # appropriate playlist document to a stream player. # also give it a directory, with .m3u onthe end, and # it will give a playlist of all the mp3 files there. $path = $ARGV[0]; # $path = "$ENV{DOCUMENT_ROOT}/$path"; $path =~ s/m3u$/mp3/; # change extension # warn "path is $path"; print "Content-type: audio/x-mpegurl\n\n"; if($path =~ s#/.mp3$##) { @files = glob("$path/*.mp3"); # warn "we're globbing.."; } else { @files = ($path); } # turn each into a full URL foreach (@files) { s#/www#http://jetsam.detritus.net#i; print "$_\n"; }