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::Find::Base(3) User Contributed Perl Documentation MP3::Find::Base(3)
 

MP3::Find::Base - Base class for MP3::Find backends

    package MyFinder;
    use base 'MP3::Find::Base';
    
    sub search {
        my $self = shift;
        my ($query, $dirs, $sort, $options) = @_;
        
        # do something to find and sort the mp3s...
        my @results = do_something(...);
        
        return @results;
    }
    
    package main;
    my $finder = MyFinder->new;
    
    # see MP3::Find for details about %options
    print "$_\n" foreach $finder->find_mp3s(\%options);

This is the base class for the classes that actually do the searching and sorting for MP3::Find.

Really simple constructor. If you pass it a hash of options, it will hang on to them for you. This is the one you should override in your subclass. If you don't, the base class "search" method will croak.
The "search" method is called by the "find_mp3s" method with the following arguments: the finder object, a hashref of query parameters, an arrayref of directories to search, and a hashref of miscellaneous options.
The search method should return a list of hashrefs representing the results of the search. Each hashref should have the following keys (all except "FILENAME" are derived from the keys returned by the "get_mp3tag" and "get_mp3Info" functions from MP3::Info):
    FILENAME
    
    TITLE
    ARTIST
    ALBUM
    YEAR
    COMMENT
    GENRE
    TRACKNUM
    
    VERSION         -- MPEG audio version (1, 2, 2.5)
    LAYER           -- MPEG layer description (1, 2, 3)
    STEREO          -- boolean for audio is in stereo
    
    VBR             -- boolean for variable bitrate
    BITRATE         -- bitrate in kbps (average for VBR files)
    FREQUENCY       -- frequency in kHz
    SIZE            -- bytes in audio stream
    OFFSET          -- bytes offset that stream begins
    
    SECS            -- total seconds
    MM              -- minutes
    SS              -- leftover seconds
    MS              -- leftover milliseconds
    TIME            -- time in MM:SS
    
    COPYRIGHT       -- boolean for audio is copyrighted
    PADDING         -- boolean for MP3 frames are padded
    MODE            -- channel mode (0 = stereo, 1 = joint stereo,
                    -- 2 = dual channel, 3 = single channel)
    FRAMES          -- approximate number of frames
    FRAME_LENGTH    -- approximate length of a frame
    VBR_SCALE       -- VBR scale from VBR header

The method that should be called by the program doing the searching.
See MP3::Find for an explanation of the options that can be passed to "find_mp3s".

More format codes? Possibly look into using String::Format

MP3::Find, MP3::Find::Filesystem, MP3::Find::DB
See MP3::Info for more information about the fields you can search and sort on.

Peter Eichman <peichman@cpan.org>

Copyright (c) 2006 by Peter Eichman. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2011-06-08 perl v5.28.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.