Hartie
Tutoriale,hackuri,filme,jocuri si multe altele !
|
Nou pe simpatie: Angi
 | Femeie 25 ani Bucuresti cauta Barbat 26 - 52 ani |
|
|
HartieInregistrareLoginPozeNu sunteti logat. Lista Forumurilor Pe Tematici
|
| #1 |
HartieAdministrator
Postari: 939
|
|
Primeste un playlist de winamp care sa contina mp3'uri(cu altceva nu am incercat) Testat cu Active Perl 5.8.7.815 si Winamp 2.95 dar probabil merge cu orice perl si orice winamp
Trebuiesc setate "$PORT","$LIST" si "$NAME"
Versiune formatata: http://rootb0x.com/0X0/rad-0.1.txt
Cod:
#!/usr/bin/perl use IO::Socket; $SIG{CHLD}=sub {wait ()};
$PORT=8000; $LIST="playlist.m3u"; $NAME="<<My tiny online radio station>>";
open(PLAYLIST,$LIST) || die("Error: Could not open $LIST\r\n"; @songs=<PLAYLIST>; close PLAYLIST;
$server=IO::Socket::INET->new(Proto =>'tcp', LocalPort=>$PORT, Listen =>SOMAXCONN, Reuse =>1); if($server) { while(1) { while($client=$server->accept()) { $client->autoflush(1); if(!fork()) { foreach $song (@songs) { chomp($song); if(index($song,'#')==-1) { print("playing song: $song\n"; print $client "ICY 200 OK\r\n"; print $client "Content-Type: audio/x-mp3stream\r\n"; print $client "Cache-Control: no-cache\r\n"; print $client "Pragma: no-cache\r\n"; print $client "Connection: close\r\n"; print $client "icy-name: $NAME\r\n"; print $client "icy-metadata: 0\r\n\r\n";
open (SONG,"$song"; binmode(SONG); $read_status =1; $print_status=1; $chunk; while($read_status && $print_status) { $read_status=read(SONG,$chunk,1024); if(defined $chunk && defined $read_status) { $print_status=print $client $chunk; } undef $chunk; } close SONG; } } exit(0); } close($client); } } }
Am uitat... Winamp->ADD->ADD URL->"IP:PORT"
|
|
| |
|