MP3::ID3v1Tag - Edit ID3v1 Tags from an Audio MPEG Layer 3.


MP3-ID3v1Tag documentation  | view source Contained in the MP3-ID3v1Tag distribution.

Index


NAME

Top

MP3::ID3v1Tag - Edit ID3v1 Tags from an Audio MPEG Layer 3.

SYNOPSIS

Top

  use MP3::ID3v1Tag;

  $mp3_file = new MP3::ID3v1Tag("filename.mp3");
  $mp3_file->print_tag();

  if($mp3_file->got_tag()) {
     $mp3_file->set_title($title); 
     $save_status = $mp3_file->save();
  }




DESCRIPTION

Top

The ID3v1Tag routines are useful for setting and reading ID3 MP3 Audio Tags. Just create an MP3::ID3v1Tag Object with the path to the file of interest, and query any of the methods below.

Checking for the Existance of ID3 Tags

There is a handy method named got_tag() that can be easily used to determine if a particular MP3 file contains an ID3 Tag.

  if $mp3_file->got_tag() {
     $mp3_file->print_tag();
  }

Viewing Tag Compontents individually

There exist several methods that will return you the individual components of the ID3 Tag.

  $title     = $mp3_file->get_title();
  $artist    = $mp3_file->get_artist();
  $album     = $mp3_file->get_album();
  $year      = $mp3_file->get_year();
  $genre     = $mp3_file->get_genre();
  $genre_num = $mp3_file->get_genre_num();
  $comment   = $mp3_file->get_comment();

Editing and Removing Tags

Similar methods exist to allow you to change the components of the Tag, but none of the changes will actually be changed in the file until you call the save() routine.

  $mp3_file->set_title("New Title");
  $mp3_file->set_artist("New Artist");
  $mp3_file->set_album("New Album");
  $mp3_file->set_year(1999);
  $mp3_file->set_genre("Blues"); 
  # Or use the genre numbers ->
  $mp3_file->set_genre_num(0);

To remove an tag in its entirely just calling the remove_tag() method should work for you.

 $mp3_file->remove_tag() if $mp3_file->got_tag();

 You could access all the components directly for a read only loop such
as the following

foreach (sort $mp3_file->tag) { print "$_: " . $mp3_file->tag($_) . "\n"; }

AUTHOR

Top

Sander van Zoest <svanzoest@cpan.org>

THANKS

Top

Matt Plummer <matt@mp3.com>, Mike Oliphant <oliphant@gtk.org>, Matt DiMeo <mattd@mp3.com>, Olaf Maetzner, Jason Bodnar and Peter Johansson

COPYRIGHT

Top

REFERENCES

Top

For general overview of MPEG 1.0, Layer 3 (MP3) Audio visit <http://help.mp3.com/help/gettingstarted/guide.html> or get the book, "MP3: The Definitive Guide" by O'Reilly and Associates <http://www.oreilly.com/catalog/mp3/>.

For technical details about MP3 Audio read the ISO/IEC 11172 and ISO/IEC 13818 specifications, obtained via <http://www.ANSI.org/> in the US or <http://www.ISO.ch/> elsewhere in the world. For more information also check out <http://www.mp3-tech.org/> compiled by Gabriel Bouvigne.

For more specific references to the MP3 Audio ID3 Tags visit <http://www.id3.org/>

For information about ID3v2 and a perl implementation see MPEG::ID3v2Tag written by Matt DiMeo <mattd@mp3.com>.


MP3-ID3v1Tag documentation  | view source Contained in the MP3-ID3v1Tag distribution.