http://qs321.pair.com?node_id=392748


in reply to Re: Re: MP3 server with IO::Socket
in thread MP3 server with IO::Socket

Hey, I thought this was very clever, but thought I'd shorten it into the worlds smallest (and least feature-full) MP3 server:
#!/bin/bash PLAYLIST=`find ./content -name *.mp3` NUM=`echo $PLAYLIST | wc -w` { while true; do rand=$(($RANDOM%$NUM)) song=`echo $PLAYLIST | cut -d ' ' -f$rand` echo "HTTP/1.0 200 OK\nContent-Type: audio/x-mp3stream\n\n" dd if=$song bs=1024 done } | nc -l -p 8020
Broadcasting to the entire world! :)