GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
MP3::Sorted(3) User Contributed Perl Documentation MP3::Sorted(3)

Apache::MP3::Sorted - Generate sorted streamable directories of MP3 files

 # httpd.conf or srm.conf
 AddType audio/mpeg    mp3 MP3

 # httpd.conf or access.conf
 <Location /songs>
   SetHandler perl-script
   PerlHandler Apache::MP3::Sorted
   PerlSetVar  SortFields    Album,Title,-Duration
   PerlSetVar  Fields        Title,Artist,Album,Duration
 </Location>

Apache::MP3::Sorted subclasses Apache::MP3 to allow for sorting of MP3 listings by various criteria. See Apache::MP3 for details on installing and using.

This class adds one new Apache configuration variable, SortFields. This is a list of the names of the fields to sort by default when the MP3 file listing is first displayed, after which the user can change the sort field by clicking on the column headers.
SortFields field
The value of SortFields may contain the names of any of the fields in the listing, such as Title, or Album Duration. By default, the sort direction will be alphabetically or numerically ascending. Reverse this by placing a "-" in front of the field name (for symmetry, you can also prepend a "+" to signify normal ascending order). After the initial sort, the user can change the sort order by clicking on the column headings of the file listing table.

Examples:

  PerlSetVar SortFields  Album,Title    # sort ascending by album, then title
  PerlSetVar SortFields  +Artist,-Kbps  # sort ascending by artist, descending by kbps
    

When constructing a playlist from a recursive directory listing, sorting will be global across all directories. If no sort order is specified, then the module reverts to sorting by file and directory name. A good value for SortFields is to sort by Artist,Album and track:

  PerlSetVar SortFields Artist,Album,Track
    

Alternatively, you might want to sort by Description, which effectively sorts by title, artist and album.

The following are valid fields:

    Field        Description

    album        The album
    artist       The artist
    bitrate      Streaming rate of song in kbps
    comment      The comment field
    description  Description, as controlled by DescriptionFormat
    duration     Duration of the song in hour, minute, second format
    filename     The physical name of the .mp3 file
    genre        The genre
    samplerate   Sample rate, in KHz
    seconds      Duration of the song in seconds
    title        The title of the song
    track        The track number
    

Field names are case insensitive.

Apache::MP3::Sorted overrides the following methods:

 sort_mp3s()  mp3_table_header()   mp3_list_bottom()

It adds one new method:

$field = $mp3->sort_fields
Returns a list of the names of the fields to sort on by default.

Let me know.

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.

Tim Ayers <tayers@bridge.com> conceived and implemented the multiple field sorting system.

Apache::MP3, MP3::Info, Apache
2006-01-03 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.