tagged

 view release on metacpan or  search on metacpan

Tag.pm  view on Meta::CPAN

package MP3::Tag;

################
#
# provides a general interface for different modules, which can read tags
#
# at the moment MP3::Tag works with MP3::TAG::ID3v1 and MP3::TAG::ID3v2

use strict;
use MP3::TAG::ID3v1;
use MP3::TAG::ID3v2;
use vars qw/$VERSION/;

$VERSION="0.1";

=pod

=head1 NAME

Tag - Perl extension reading tags of mp3 files

=head1 SYNOPSIS

  use Tag;
  $mp3 = MP3::Tag->new($filename);
  $mp3->getTags;

  if (exists $mp3->{ID3v1}) {
    $id3v1 = $mp3->{ID3v1};
    print $id3v1->song;
    ...
  }

  if (exists $mp3->{ID3v2}) {
    ($name, $info) = $mp3->{ID3v2}->getFrame("TIT2");
    ...
  }

=head1 AUTHOR

Thomas Geffert, thg@users.sourceforge.net

=head1 DESCRIPTION

Tag is a wrapper module to read different tags of mp3 files. 
It provides an easy way to access the functions of seperate moduls
which do the handling of reading/writing the tags itself.

At the moment MP3::TAG::ID3v1 and MP3::TAG::ID3v2 are supported.

!! As this is only a beta version, it is very likely that the design 
!! of this wrapper module will change soon !!

=over 4

=item new

 $mp3 = MP3::TAG->new($filename);

Creates a mp3-object, which can be used to retrieve/set
different tags.

=cut

sub new {
  my $class = shift;
  my $self={filename=>shift};
  return undef unless -f $self->{filename};
  bless $self, $class;
  return $self;
}

=pod

=item getTags

  @tags = $mp3->getTags;

Checks which tags can be found in the mp3-object. It returns
a list @tags which contains strings identifying the found tags.

Each found tag can be accessed then with $mp3->{tagname} .

Use the information found in MP3::TAG::ID3v1 and MP3::TAG::ID3v2
to see what you can do with the tags.



( run in 2.575 seconds using v1.01-cache-2.11-cpan-5a3173703d6 )