NAME
Net::Icecast - Object oriented functions to run your icecast server by bash operations.
SYNOPSIS
require Net::Icecast;
DESCRIPTION
WARNING!!! This module can only be use if your icecast server is older than version 1.3.7
The commands you're used to find in an icecast server are in this module (Not all but only the ones i needed!). They can permit you to create programs that configure your icecast server by bash operations. If you find that there are importants functions that need to be add, you can modify it under the same terms as Perl itself! (If you want more details about the functions see the icecast commands documentation)
So good fun...
OBJECTS
(be careful with the orthography of the objects, the orthography is the same that the icecast's commands)
- Sources object : Properties: id : source's id host : source's host
- mountpoint : source's mountpoint connect for : source connection time ip : source's ip song : song sent by the source
- Listeners object : Properties: id : listener's id host : listener's host mountpoint : listener's mountpoint connect for : listener connection time source_id : listener's source id.
METHODS To be connected to the icecast server as an admin Net::Icecast->new($host,$port,$admin_password)
Returns a hash table of alls connected sources / listeners $my_session->sources() $my_session->listeners()
Differents methods $my_session->set() $my_session->modify() $my_session->allow() you can't do "allow ... list" $my_session->deny() you can't do "deny ... list" $my_session->kick() $my_session->selection() $my_session->alias() $my_session->dir() $my_session->touch() $my_session->status() $my_session->debug()
EXAMPLE
First of all you have to run your icecast server, run a source encoder, and a client (to do this take a look at the doc). Then execute this code in a perl programm:
#Programme gives you informations about the clients and sources in your icecast server
#!/usr/bin/perl
require Icecast;
my $session = Net::Icecast->new("icecast.computer.host",$port?,"ADMIN_Password");
$session->set_oper("OPER_Password");
my %sources = $session->sources;
print "Sources:\n";
foreach $key (keys %sources) { #To print the IP address, ... print "Id : $key, host : $sources{$key}->{host}\n"; }
my %clients = $session->listeners; print "Clients:\n";
foreach $key (keys %clients) { #To print the source id, the mount point... print "Id : $key, host : $clients{$key}->{host}\n"; }
#And if you want to change the admin_password #$session->set("admin_password my_new_password");
#or client_password: #$session->set("client_password secret_password");
#And you can test other functions with the same way #that you test this one!
#Isn't it very simple to use it :)
AUTHOR
Andrès Marino
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 553:
Non-ASCII character seen before =encoding in 'Andrès'. Assuming CP1252