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.
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.");
}
}
}
Lyrics3v1Tag
,
Lyrics3v1 Spec,
Lyrics3v2 SpecConstructor and Description |
---|
Lyrics3v2Tag(java.io.RandomAccessFile file)
constructor used to read in a Lyrics3v2 tag from an .mp3 file.
|
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.
|
public Lyrics3v2Tag(java.io.RandomAccessFile file) throws java.io.IOException, ParseException
file
- random access file to read in the Lyrics3v2 tag from an .mp3 file.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.public boolean isLyricsPresent()
public boolean isTimestampPresent()
public boolean isRandomTrackSelectionAllowed()
public java.lang.String getLyrics()
public java.lang.String getAdditionalInfo()
public java.lang.String getAuthorName()
public java.lang.String getAlbumName()
public java.lang.String getArtistName()
public java.lang.String getTrackTitle()
public java.lang.String getImageLink()
public java.lang.String getCRC()
public int getSize()
public int getFilePosition()
public java.lang.String toString()
toString
in class java.lang.Object