The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

AnyEvent::DAAP::Server::Track - Base class of daap tracks

DESCRIPTION

This class abstractly represents one track. Usually you will want to use AnyEvent::DAAP::Server::Track::File::MP3 for local mp3 files.

METHODS

my $data = $track->data([ $pos ]);

Abstract method. Should return track's music data immediately. If $track allows ranged request, the $pos parameter may be supplied. If so, $track should return data from the position at $pos byte.

my $bool = $track->allow_range;

Override this to return true if this track allows ranged request (i.e. skip/pause). Defaults to return 0.

$track->write_data($connection, $res, $pos);

Override this method if you want to send data to clients asynchronously.

$connection argument is an AnyEvent::DAAP::Server::Connection. $connection->handle is an AnyEvent::Handle so call $connection->handle->push_write() this to send data.

$res argument is partially filled HTTP::Response, without $res->content and $res->content_length.

$pos argument is requested start-position of music data or undef.

After writing all data, you should send $connection->handle->push_shutdown().

$track->daap_***, $track->dmap_***

Read AnyEvent::DAAP::Server::Track::File::MP3's source to grab what these mean.

AUTHOR

motemen <motemen@gmail.com>

SEE ALSO

AnyEvent::DAAP::Server::Track::File::MP3

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.