Apache::MP3::Playlist - Manage directories of MP3 files with sorting and persistent playlists
# httpd.conf or srm.conf AddType audio/mpeg mp3 MP3 # httpd.conf or access.conf <Location /songs> SetHandler perl-script PerlHandler Apache::MP3::Playlist PerlSetVar SortField Title PerlSetVar Fields Title,Artist,Album,Duration </Location>
Apache::MP3::Playlist subclasses Apache::MP3::Sorted to allow the user to build playlists across directories. Playlists are stored in cookies and are persistent for the life of the browser. See Apache::MP3 and Apache::MP3::Sorted for details on installing and using.
The "playlist" class in the apache_mp3.css cascading stylesheet defines the color of the playlist area and associated buttons.
Apache::MP3::Playlist overrides the following methods:
run(), directory_bottom(), control_buttons() and directory_top().
It adds several new methods:
Process buttons that affect the playlist.
Look up the description fields for the MP3 files indicated by the list of URIs (not paths) and return a hashref.
Get or set the current stored playlist. In a list context returns the list of URIs of stored MP3 files. In a scalar context returns an array reference. Pass a list of URIs to set the playlist.
The following new linking conventions apply:
Append "/playlist.m3u?Add+to+Playlist;file=file1;file=file2..." to the name of the directory that contains the files:
<a href="/Songs/Madonna/playlist.m3u?Add+to+Playlist=1;file=like_a_virgin.mp3;file=evita.mp3"> Two favorites</a>
Append "/playlist.m3u?Add+All+to+Playlist" to the name of the directory that contains the files:
<a href="/Songs/Madonna/playlist.m3u?Add+All+to+Playlist=1"> Madonna'a a Momma</a>
Append "/playlist.m3u?Clear+Selected=1;playlist=1;file=file1;file=file2..." to the name of the current directory.
NOTE: the file names must be absolute URLs, not relative URLs. This is because the playlist spans directories. By the same token, the current directory does not have to contain the removed song(s). Example:
<a href="/Songs/Springsteen/playlist.m3u?Clear+Selected=1; playlist=1;file=/Songs/Madonna/like_a_virgin.mp3"> No longer a virgin, alas</a>
Append "/playlist.m3u?Clear+All=1;playlist=1" to the name of the current directory.
Example:
<a href="/Songs/Springsteen/playlist.m3u?Clear+All=1;playlist=1"> A virgin playlist</a>
Append "/playlist.m3u?Play+All=1;playlist=1" to the name of the current directory.
<a href="/Songs/Madonna/playlist.m3u?Play+All=1;playlist=1"> Stream me!</a>
As above, but use "Shuffle+All" rather than "Play+All".
Append "/playlist.m3u?Play+Selected=1;playlist=1;file=file1;file=file2..." to the name of the current directory.
NOTE: the files must be full URLs. It is not strictly necessary for them to be on the current playlist, so this allows you to stream playlists of arbitrary sets of MP3 files.
<a href="/Songs/playlist.m3u?Play+Selected=1; playlist=1;file=/Songs/Madonna/like_a_virgin.mp3; file=/Songs/Madonna/working_girl.mp3; file=/Songs/Beatles/let_it_be.mp3"> Madonna and John, together again for the first time</a>
This module uses client-side cookies to mantain the playlist. This limits the number of songs that can be placed in the playlist to about 50 songs.
Chris Nandor came up with the idea for the persistent playlist and implemented it using server-side DBM files. I reimplemented it using client-side cookies, which simplifies maintenance and security, but limits playlists in size.
Copyright 2000, Lincoln Stein <lstein@cshl.org>.
This module is distributed under the same terms as Perl itself. Feel free to use, modify and redistribute it as long as you retain the correct attribution.
Apache::MP3::Sorted, Apache::MP3, MP3::Info, Apache
2 POD Errors
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
'=item' outside of any '=over'
To install Apache::MP3, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::MP3
CPAN shell
perl -MCPAN -e shell install Apache::MP3
For more information on module installation, please visit the detailed CPAN module installation guide.