MP3::TAG::ID3v1 - Perl extension for reading / writing ID3v1 tags of mp3-files


tagged documentation  | view source Contained in the tagged distribution.

Index


NAME

Top

MP3::TAG::ID3v1 - Perl extension for reading / writing ID3v1 tags of mp3-files

SYNOPSIS

Top

MP3::TAG::ID3v2 is designed to be called from the MP3::Tag module. It then returns a ID3v2-tag-object, which can be used in a users program.

  use MP3::TAG::ID3v1;
  $id3v1 = MP3::TAG::ID3v1->new($mp3obj);

$mp3obj is a object from MP3::Tag. See according documentation. $tag is undef when no tag is found in the $mp3obj.

* Reading the tag

    print "   Song: " .$id3v1->song . "\n";
    print " Artist: " .$id3v1->artist . "\n";
    print "  Album: " .$id3v1->album . "\n";
    print "Comment: " .$id3v1->comment . "\n";
    print "   Year: " .$id3v1->year . "\n";
    print "  Genre: " .$id3v1->genre . "\n";
    print "  Track: " .$id3v1->track . "\n";
    @tagdata = $mp3->all();
    foreach (@tagdata) {
      print $_;
    }

* Changing / Writing the tag

      $id3v1->comment("This is only a Test Tag");
      $id3v1->song("testing");
      $id3v1->artist("Artest");
      $id3v1->album("Test it");
      $id3v1->year("1965");
      $id3v1->track("5");
      $id3v1->genre("Blues");
      # or at once
      $id3v1->all("song title","artist","album","1900","comment",10,"Ska");#
      $id3v1->writeTag;

AUTHOR

Top

Thomas Geffert, thg@users.sourceforge.net

DESCRIPTION

Top

  $id3v1 = MP3::TAG::ID3v1->new($mp3obj[, $create]);

Generally called from MP3::TAG, because a $mp3obj is needed. If $create is true, a new tag is created. Otherwise undef is returned, if now ID3v1 tag is found in the $mp3obj.

  $artist  = $id3v1->artist;
  $artist  = $id3v1->artist($artist);
  $album   = $id3v1->album;
  $album   = $id3v1->album($album);
  $year    = $id3v1->year;
  $year    = $id3v1->year($year);
  $comment = $id3v1->comment;
  $comment = $id3v1->comment($comment);
  $track   = $id3v1->track;
  $track   = $id3v1->track($track);
  $genre   = $id3v1->genre;
  $genre   = $id3v1->genre($genre);

Use these functions to retrieve the date of these fields, or to set the data.

$genre can be a string with the name of the genre, or a number describing the genre.

  @tagdata = $id3v1->all;
  @tagdata = $id3v1->all($song, $artist, $album, $year, $comment, $track, $genre);

Returns all information of the tag in a list. You can use this sub also to set the data of the complete tag.

The order of the data is always song, artist, album, year, comment, track, and genre. genre has to be a string with the name of the genre, or a number identifying the genre.

  $id3v1->writeTag;

Writes the ID3v1 tag to the file.

  $id3v1->removeTag;

Removes the ID3v1 tag from the file.

  @allgenres = $id3v1->genres;
  $genreName = $id3v1->genres($genreID);
  $genreID   = $id3v1->genres($genreName);  

Returns a list of all genres, or the according name or id to a given id or name.

SEE ALSO

Top

MP3::Tag, MP3::TAG::ID3v2

ID3v1 standard - http://www.id3.org


tagged documentation  | view source Contained in the tagged distribution.