MP3::Archive::Format(3)

NAME
MP3::Archive::Format - Helper class for MP3::Archive

SYNOPSIS
    use MP3::Archive::Format;
    my $f=MP3::Archive::Format->new;
    if($f->validate($file,$format) {
        print("Track num: ",$f->tracknum($file,$format),
              "Artist: ",$f->($file,$format),
              "Album: ",$f->($file,$format),
              "Track: ",$f->($file,$format),
              "Ext: ",$f->($file,$format),"\n");
    }
    print("Correct path: ",
          $f->makepathname($fromfile,$artist,$album,$format),"/",
          $f->makefilename($fromfile,$tracknum,$artist,$album,$track,$ext,$format),"\n");

DESCRIPTION
MP3::Archive::Format is a helper class for MP3::Archive. Many of the methods in it are essentially duplicates of ones in MP3::Archive(3), but with the formats specified explicitly rather than inferred from configuration. These are used internally, but can also be useful if you need more control from your application.

METHODS

  new
Creates an instance of MP3::Archive::Format

  tracknum, artist, album, track, ext, validate, makefilename, makepathname
These methods are essentially the same as their counterparts in MP3::Archive, with the exception that they expect a format as well as a filename (eg "artist($file, $format)", and do not take an optional tracktype. A format is a reference to an array of strings containing regular expressions. See MP3::Archive::Config(3) for details on formats.

INTERNAL METHODS

  replace($format,$var,$tag)
Replaces $tag with $var in $format. $tag can be one of "TRKNUM", "ARTIST", "ALBUM", or "TRACK".

  parse($file,$format,$tag)
Parse formats. $tag is the tag (eg "ARTIST") we are interested in. Returns the matching data. If called in array context, also returns the offset of the start of that data.

BUGS
None known. Please report any found to ianb@nessie.mcc.ac.uk

SEE ALSO
MP3::Archive(3) MP3::Archive::Config(3), mp3lint(1), mp3-archive-tools(1)

AUTHOR
Ian Beckwith <ianb@nessie.mcc.ac.uk>