• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

MP3/H15-Apr-2006-4,1682,231

apache_mp3/H03-May-2022-9476

screenshots/H03-May-2022-

ChangesH A D03-Jan-20067.1 KiB187153

MANIFESTH A D01-Aug-20051.1 KiB6362

META.ymlH A D15-Apr-2006570 1816

MP3.pmH A D03-Jan-200694 KiB3,1071,475

Makefile.PLH A D15-Apr-2006883 2218

READMEH A D15-Apr-20065.1 KiB14198

README

1Apache::MP3 Version 4.0
2
3This module takes a hierarchy of directories containing MP3, Ogg
4Vorbis, or Wav audio files and presents it as a browsable and
5searchable song library for streaming over the web.  It requires the
6Apache (version 2) web server, the mod_perl (version 2) embedded Perl
7interpreter, and either or both of the MP3::Info and Ogg::Vorbis
8modules. In addition, you must have Locale::Maketext and CGI::Session
9installed.
10
11Audio files are displayed in a list that shows the title, artist, duration
12and bitrate.  Subdirectories are displayed with "CD" icons. The user can
13download an MP3 file to disk by clicking on its title, stream it to an MP3
14decoder by clicking on the "play" link. Users can also stream the entire
15contents of a directory, or select a subset of songs to play.
16
17A DEMO is available at http://www.modperl.com/Songs.  In this demo, stream
18time is limited to 30 seconds in order to avoid copyright infringement.
19
20See the "screenshots" directory for some pictures of Apache::MP3 in action.
21
22See below for CHANGES.
23
24INSTALLATION
25
261. Prequisites
27
28This module requires mod_perl, MP3::Info, MP3::Icecast and Locale::Maketext,
29all of which are available on CPAN.  Locale::Maketext in turn requires
30I18N::LangTags.
31
322. Configure MIME types
33
34Apache must be configured to recognize the mp3 and MP3 extensions as MIME
35type audio/mpeg.  Add the following to httpd.conf or srm.conf:
36
37 AddType audio/mpeg mp3 MP3
38 AddType audio/playlist m3u M3U
39
40If you plan to use Shoutcast-style playlists, add the following as well:
41
42 AddType audio/x-scpls pls PLS
43
44If you plan to use Ogg Vorbis, add the following as well:
45
46 AddType application/x-ogg ogg OGG
47
483. Install icons and stylesheet
49
50This module uses a set of icons and a cascading stylesheet to generate its
51song listings.  By default, the module expects to find them at the url
52/apache_mp3.  Create a directory named apache_mp3 in your document root,
53and copy into it the contents of the F<apache_mp3> directory from the
54Apache::MP3 distribution.
55
56You may change the location of this directory by setting the I<BaseDir>
57configuration variable.  See the I<Customizing> section for more details.
58
594. Set Apache::MP3 to be the handler for the songs directory
60
61In httpd.conf or access.conf, create a E<lt>LocationE<gt> or
62E<lt>DirectoryE<gt> section, and make Apache::MP3 the handler for this
63directory.  This example assumes you are using the URL /Songs as the
64directory where you will be storing song files:
65
66  <Location /Songs>
67    SetHandler perl-script
68    PerlHandler Apache::MP3
69  </Location>
70
71If you would prefer the song file listing that allows the user to sort it
72in various ways, set the handler to use the Apache::MP3::Sorted subclass
73instead.  A further elaboration is Apache::MP3::Playlist, which uses
74cookies to manage a persistent playlist for the user.
75
765. Load MP3::Info in the Perl Startup file (optional)
77
78For the purposes of faster startup and memory efficiency, you may load the
79MP3::Info module at server startup time.  If you have a mod_perl "startup"
80file, enter these lines:
81
82  use MP3::Info;
83  use Apache::MP3;
84
856. Set up song directory
86
87Create a directory in the web server document tree that will contain the
88audio files to be served.  The module recognizes and handles
89subdirectories appropriately.  I suggest organizing directories
90hierarchically by artist and/or album name.
91
92If you place a file named "cover.jpg" in any of the directories, that
93image will be displayed at the top of the directory listing.  You can use
94this to display cover art.
95
96If you place a list of .mp3 file names in a file with the .m3u extension,
97it will be treated as a playlist and displayed to the user with a
98distinctive icon.  Selecting the playlist icon will download the playlist
99and stream its contents.  The playlist must contain relative file names,
100but may refer to subdirectories, as in this example:
101
102  # file: folk_favorites.m3u
103  Never_a_Moment_s_Thought_v2.mp3
104  Peter Paul & Mary - Leaving On A Jet Plane.mp3
105  Simon and Garfunkel/Simon And Garfunkel - April Come She Will.mp3
106
1077. Set up an information cache directory (optional)
108
109In order to generate its MP3 listing, Apache::MP3 must open each sound
110file, extract its header information, and close it.  This is time
111consuming, particularly when recursively generating playlists across
112multiple directories.  To speed up this process, Apache::MP3 has the
113ability cache MP3 file information in a separate directory area.
114
115To configure this, choose a directory that the Web server has write access
116for, such as /usr/tmp.  Then add a configuration variable like the
117following to the <Location> directive:
118
119 PerlSetVar  CacheDir       /usr/tmp/mp3_cache
120
121If the designated directory does not exist, Apache::MP3 will attempt to
122create it, limited of course by the Web server's privileges.  You may need
123to create the mp3_cache directory yourself if /usr/tmp is not world
124writable.
125
126TESTING IT
127
128Open up the MP3 URL in your favorite browser.  You should be able to see
129directory listings, and download and stream your songs.  If things don't
130seem to be working, checking the server error log for messages.
131
132Run "perldoc Apache::MP3" for more configuration information.
133
134CHANGES
135
136See Changes.
137
138AUTHORS
139
140Lincoln Stein, <lstein@cshl.org>
141