MP3::Napster::Song - Object-oriented access to Napster shared songs
@songs = $nap->browse('sexybabe'); foreach $song (@songs) { print $song->name,"\n"; print $song->size,"\n"; print $song->bitrate,"\n"; print $song->freq,"\n"; print $song->owner,"\n"; print $song->length,"\n"; print $song->hash,"\n"; print $song->address,"\n"; print $song->link,"\n"; } $songs[0]->download; # download to local disk
MP3::Napster::Song provides object-oriented access to shared MP3 files that can be retrieved via the Napster network protocol.
Song objects are normally not constructed de novo, but are returned by search() and browse() calls to MPEG::Napster objects.
Object methods provide access to various attributes of the sound file, and allow you to download the file to disk or pass its data to a pipe.
The accessors provide read-only access to the Song object's attributes.
Accessor Description -------- ----------- $song->name Title of the song, often including artist $song->title Same as above $song->size Physical size of file, in bytes $song->bitrate Bit rate of MP3 data, in kilobits/sec $song->freq Sampling frequency, in Hz $song->length Duration of song, in seconds $song->owner Owner of the song, as an MP3::Napster::User object $song->path Physical path of the song, at the remote end $song->hash MD5 hash of the first 300K of the song, for identification $song->address IP address of the client that holds the song $song->link The link speed of the owner, as a string (e.g. LINK_DSL) $song->link_code The link speed of the owner, as a numeric code (e.g. 3) $song->server The MP3::Napster object from which this song was retrieved
The download() method will initiate a download on the song. The method behaves like the MP3::Napster->download() method. If no argument is provided, the method will open up a file in the location specified by the MP3::Napster object's download_dir() method. Otherwise the song data will be written to the indicated path or filehandle.
If successful, the method will return a MP3::Napster::Transfer object, which can be used to monitor and control the download process.
If used in a string context, MPEG::Napster::Song objects will invoke the name() method. This allows the objects to be directly interpolated into strings, printed, and pattern matched.
Lincoln Stein <lstein@cshl.org>.
Copyright (c) 2000 Cold Spring Harbor Laboratory. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
MP3::Napster, MP3::Napster::User, MP3::Napster::Channel, and MPEG::Napster::Transfer
To install MP3::Napster, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MP3::Napster
CPAN shell
perl -MCPAN -e shell install MP3::Napster
For more information on module installation, please visit the detailed CPAN module installation guide.