Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^3: MP3 server with IO::Socket

by Anonymous Monk
on Sep 21, 2004 at 19:39 UTC ( #392748=note: print w/replies, xml ) Need Help??

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! :)

Replies are listed 'Best First'.
Re^4: MP3 server with IO::Socket
by Anonymous Monk on Sep 22, 2004 at 20:14 UTC
    No, this would be the shortest.. and a command line command:
    while true; do NUM=`find /home/MP3/Bob_marley/*.mp3 | wc -l`; rand=$(( +$RANDOM%$NUM)); song=`find /home/MP3/Bob_marley/*.mp3 | sed -n ${rand +}p`; echo "HTTP/1.0 200 OK\nContent-Type: audio/x-mp3stream\n\n"; dd +if="$song" bs=1024; done | nc -l -p 8020
    -- --

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://392748]
[Eily]: LanX can't be, they're both on the picture at the same time. Duh
[LanX]: They hired a Hollywood producer to fake the pic
LanX has to go and change location, I can hear THEM on the stairs...
[Eily]: they can't actually fake the pics, that's what they want you to believe so that you can't accept obvious proofs

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2018-03-19 15:36 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (241 votes). Check out past polls.