Netx::WebRadio - receive one or more webradio-stations
use Netx::WebRadio my $receiver = Netx::WebRadio->new(); my $station = Netx::WebRadio::Station::Shoutcast->new(); $station->host( $server->[0] ); $station->port( $server->[1] ); $receiver->add_station( $station ) if $station->connect( $server->[0], $server->[1] ) ; while ($receiver->number_of_stations) { $receiver->receive(); }
THIS IS BETA SOFTWARE!
Netx::WebRadio is a framework for receiving one or more webradio streams.
It's implemented with the so-called 'template-pattern' - inherit from it and overload some mehtods.
Netx::WebRadio works as a multiplexer for one or more Netx::WebRadio::Station-objects (eg Netx::WebRadio::Station::Shoutcast).
To change the handling of certain events (timeout, disconnect) you have to overload some methods.
Look at the Examples/ directory for examples.
Usage : $receiver->add_station( $station ) Purpose : Adds a (already connected) station for receiving. Returns : nothing Argument : station-object Throws : nothing See Also : remove_station
Usage : $receiver->remove_station( $station ) Purpose : Removes a station. Returns : nothing Argument : station-object Throws : nothing
Usage : $receiver->number_of_stations() Purpose : Returns the number of stations. Returns : number of stations Argument : nothing Throws : nothing See Also :
Usage : $receiver->receive() Purpose : Tries to receive next chunk from all stations. Call it in a loop. Returns : nothing Argument : nothing Throws : nothing See Also :
Usage : $receiver->timeout( 30 ) Purpose : Sets the timeout value for all stations. Returns : nothing Argument : timeout in seconds Throws : nothing See Also : timeout_all_stations
Overload the following methods:
Usage : init is called from new Purpose : Initializes some values, create Poll-Object. Always call SUPER::init if you overload this method. Returns : nothing Argument : nothing Throws : nothing See Also :
Usage : timeout_all_stations is called if there is a network-timeout. Purpose : overload it :) You can change the timeout-time with the 'timeout'-method. Returns : nothing Argument : nothing Throws : nothing See Also : timeout
Usage : error_in_station is called if a station returns an error. Purpose : overload it :) The default implementation removes the station from the receiver. Returns : nothing Argument : nothing Throws : nothing See Also : timeout
Doesn't work under Win32... please send patches :-)
Nathanael Obermayer CPAN ID: nathanael natom-pause@smi2le.net
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
perl(1).
To install Netx::WebRadio, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Netx::WebRadio
CPAN shell
perl -MCPAN -e shell install Netx::WebRadio
For more information on module installation, please visit the detailed CPAN module installation guide.