com.beaglebuddy.lyrics3

## Class Lyrics3v2Tag

- java.lang.Object
- - com.beaglebuddy.lyrics3.Lyrics3v2Tag

-     public class Lyrics3v2Tag
      extends java.lang.Object

  This class provides methods for reading the optional Lyrics3v2 tag, which is found at the end of an .mp3 file after the `mpeg audio`, data and before the `ID3v1 tag` as shown below. It is an obsolete tag that really should just be removed from your .mp3 files. See the CleanMP3Files.java file provided in the sample code to see how this is done.

  note: The documentation at http://id3.org/Lyrics3v2 contains the following errors:
  - the size part of a field is 5 characters long, not 6
  - the indications field is only 2 characters long, not 3
  - CRC is missing from the list of defined fields

       import java.io.IOException;
       import com.beaglebuddy.mp3.MP3;
       import com.beaglebuddy.lyrics3.Lyrics3v2Tag;

       public class Lyrics3v2Example
       {
          public static void main(String[] args)
          {
             try
             {
                MP3 mp3 = new MP3("c:/mp3/Wild Cat.mp3");

                if (mp3.hasLyrics3v2Tag())             // if the mp3 file has a Lyrics3v2 tag
                {                                      // then display the data in it
                   Lyrics3v2Tag lyrics3v2Tag = mp3.getLyrics3v2Tag();
                   System.out.println("mp3 contains a Lyrics3v2 tag");
                   System.out.println(lyrics3v2Tag);

                   System.out.println("artist..: " + lyrics3v2Tag.getArtistName());
                   System.out.println("album...: " + lyrics3v2Tag.getAlbumName());
                   System.out.println("author..: " + lyrics3v2Tag.getAuthorName());
                   System.out.println("track...: " + lyrics3v2Tag.getTrackTitle());
                   System.out.println("add info: " + lyrics3v2Tag.getAdditionalInfo());
                   System.out.println("image...: " + lyrics3v2Tag.getImageLink());
                   System.out.println("lyrics..: " + lyrics3v2Tag.getLyrics());
                }
             }
             catch (IOException ex)
             {
                System.out.println("An error occurred while reading the mp3 file.");
             }
          }
       }

  See Also:
    `Lyrics3v1Tag`, Lyrics3v1 Spec, Lyrics3v2 Spec

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Lyrics3v2Tag(java.io.RandomAccessFile file)` constructor used to read in a Lyrics3v2 tag from an .mp3 file.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getAdditionalInfo()` get the additional information in the Lyrics3v2 tag.
    `java.lang.String` | `getAlbumName()` get the album name in the Lyrics3v2 tag.
    `java.lang.String` | `getArtistName()` get the artist name in the Lyrics3v2 tag.
    `java.lang.String` | `getAuthorName()` get the music/lyrics author's name in the Lyrics3v2 tag.
    `java.lang.String` | `getCRC()` get the CRC of the Lyrics3v2 tag.
    `int` | `getFilePosition()` get the position (in bytes) within the .mp3 file where the Lyrics3v2 tag starts.
    `java.lang.String` | `getImageLink()` get the link to an image file in .bmp or .jpg format.
    `java.lang.String` | `getLyrics()` get the lyrics in the Lyrics3v2 tag.
    `int` | `getSize()` get the size (in bytes) of the entire Lyrics3v2 tag, including the end id.
    `java.lang.String` | `getTrackTitle()` get the track title in the Lyrics3v2 tag.
    `boolean` | `isLyricsPresent()` get whether lyrics are present in the Lyrics3v2 tag.
    `boolean` | `isRandomTrackSelectionAllowed()` get whether random track selection is allowed.
    `boolean` | `isTimestampPresent()` get whether the lyrics contain timestamps in the Lyrics3v2 tag.
    `java.lang.String` | `toString()` gets a string representation of the Lyrics3v2 tag.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Lyrics3v2Tag

          public Lyrics3v2Tag(java.io.RandomAccessFile file)
                       throws java.io.IOException,
                              ParseException

      constructor used to read in a Lyrics3v2 tag from an .mp3 file.
      Parameters:
        `file` - random access file to read in the Lyrics3v2 tag from an .mp3 file.
      Throws:
        `java.io.IOException` - if there is an error while reading the Lyrics3v2 tag.
        `ParseException` - if a Lyrics3v2 tag can not be found or if an invalid value is detected while parsing the Lyrics3v2 tag.

  - ### Method Detail

    - #### isLyricsPresent

          public boolean isLyricsPresent()

      get whether lyrics are present in the Lyrics3v2 tag.
      Returns:
        whether lyrics are present in the Lyrics3v2 tag.

    - #### isTimestampPresent

          public boolean isTimestampPresent()

      get whether the lyrics contain timestamps in the Lyrics3v2 tag.
      Returns:
        whether the lyrics contain timestamps in the Lyrics3v2 tag.

    - #### isRandomTrackSelectionAllowed

          public boolean isRandomTrackSelectionAllowed()

      get whether random track selection is allowed.
      Returns:
        whether random track selection is allowed.

    - #### getLyrics

          public java.lang.String getLyrics()

      get the lyrics in the Lyrics3v2 tag.
      Returns:
        the song lyrics in the Lyrics3v2 tag, or null if the tag does not contain any.

    - #### getAdditionalInfo

          public java.lang.String getAdditionalInfo()

      get the additional information in the Lyrics3v2 tag.
      Returns:
        the additional information in the Lyrics3v2 tag, or null if the tag does not contain any.

    - #### getAuthorName

          public java.lang.String getAuthorName()

      get the music/lyrics author's name in the Lyrics3v2 tag.
      Returns:
        the music/lyrics author's name in the Lyrics3v2 tag, or null if no author's name has been specified in the tag.

    - #### getAlbumName

          public java.lang.String getAlbumName()

      get the album name in the Lyrics3v2 tag.
      Returns:
        the album name in the Lyrics3v2 tag, or null if no album name has been specified in the tag.

    - #### getArtistName

          public java.lang.String getArtistName()

      get the artist name in the Lyrics3v2 tag.
      Returns:
        the artist name in the Lyrics3v2 tag, or null if no artist's name has been specified in the tag.

    - #### getTrackTitle

          public java.lang.String getTrackTitle()

      get the track title in the Lyrics3v2 tag.
      Returns:
        the track title in the Lyrics3v2 tag, or null if no track title has been specified in the tag.

    - #### getImageLink

          public java.lang.String getImageLink()

      get the link to an image file in .bmp or .jpg format.
      Returns:
        the link to an image file in .bmp or .jpg format, or null if no image link has been specified in the tag.

    - #### getCRC

          public java.lang.String getCRC()

      get the CRC of the Lyrics3v2 tag.
      Returns:
        the CRC of the Lyrics3v2 tag, or null if the tag does not contain one.

    - #### getSize

          public int getSize()

      get the size (in bytes) of the entire Lyrics3v2 tag, including the end id.
      Returns:
        the size (in bytes) of the entire Lyrics3v2 tag, including the end id.

    - #### getFilePosition

          public int getFilePosition()

      get the position (in bytes) within the .mp3 file where the Lyrics3v2 tag starts.
      Returns:
        the position (in bytes) within the .mp3 file where the Lyrics3v2 tag starts.

    - #### toString

          public java.lang.String toString()

      gets a string representation of the Lyrics3v2 tag.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representation of the Lyrics3v2 tag.