Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

WolfSkunk ShoutForward

by strredwolf (Chaplain)
on Mar 23, 2001 at 04:28 UTC ( #66521=sourcecode: print w/ replies, xml ) Need Help??

Category: Audio Related Programs
Author/Contact Info strredwolf
Description: Crude script which takes a MP3 from a site, downsamples, and reshouts it out to an Icecast server. It'll also work with a Shoutcast server, if you shout to the next port up.

Needs MPG123 and LAME. Contact me if you want to know more about Wolfox Radio.

#!/usr/bin/perl

$|=1;

# WolfSkunk ShoutForward
# v0.2 by Kelly "STrRedWolf" Price
# A downsampling restreamer!

### Configuration....
## Where to pull from...
## (Example:  Wolfox Radio)
# $source="http://166.90.143.148:9160/";
$source="http://localhost:8000/166.90.143.148:9160/";

## Where to shout it to.
# Shouting to Icecast goes to the same server,
# but to a Shoutcast server, you need to shout it to server port+1

# Example local icecast server
$destsite='localhost';
$destport=8000;
$pass='put up one yourself';

## Lame Options.
# Default: 16kbps Mono (from sterio)
$lameopt='-b 16 -m m -a';

### Code
use IO::Socket;

print "WSS> Shouting from $source\nto $destsite:$destport...\n";

$out=IO::Socket::INET->new(Proto=>'tcp',
               PeerAddr=> $destsite,
               PeerPort=> $destport)
    or die "$!";
$out->autoflush(1);

print $out "$pass\r\n\r\n";
$code=<$out>;
print $code;
die "Got from server $code" if($code !~ /^OK/);
print "WSS> We're in!\n";
# while(<$out>)
# {
#    print "WSS> $_";
#    tr/\r\n//d;
#    last if(/^$/);
# }

print $out "icy-name: [[[WolfFox Radio]]] Charm's Mix Party! Herm Have
+n Mix-Dance-Techno/Goa\r\n";
print $out "icy-url: http://localhost:8000/\r\n";
print $out "icy-pub: 0\r\n";
print $out "icy-genre: Test\r\n";
print $out "icy-br: 20\r\n";

print $out "\r\n\r\n";

open(IN,"mpg123 -b 2048 -s $source | lame $lameopt -x -s 22.05 - - |")
+;

while(1) { $_=<IN>; print $out $_; }

close $out;
close IN;

Comment on WolfSkunk ShoutForward
Download Code

Back to Code Catacombs

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://66521]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2014-07-29 19:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (226 votes), past polls