org.farng.mp3.lyrics3
Class Lyrics3v1

java.lang.Object
  extended by org.farng.mp3.AbstractMP3FileItem
      extended by org.farng.mp3.AbstractMP3Tag
          extended by org.farng.mp3.lyrics3.AbstractLyrics3
              extended by org.farng.mp3.lyrics3.Lyrics3v1
All Implemented Interfaces:
MP3Tag

public class Lyrics3v1
extends AbstractLyrics3

 Lyrics3 made easy 

 
What is Lyrics3?

When Winamp introduced its plugin capabilities Kuo (Djohan) Shiang-shiang's Lyrics Displayer was one of the first plugins, and probably the first program that made a connection between MP3 audio and lyrics. The lyrics displayed by Kuo's Lyrics Displayer were stored in separate text files from which the program got it.

Petr Strnad saw the problems in this so he decided to make a lyrics tag, enabling the text to reside inside the audio file. This is done by creating a chunk of data which begins with "LYRICSBEGIN", ends with "LYRICSEND" and has the lyrics between these keywords. This data block is then saved in the audio file between the audio and the ID3 tag. If no ID3 tag is present one must be attached.

The following simple rules applies to the lyrics inserted between the keywords:

  • The keywords "LYRICSBEGIN" and "LYRICSEND" must not be present in the lyrics.
  • The text is encoded with ISO-8859-1 character set
  • A byte in the text must not have the binary value 255.
  • The maximum length of the lyrics is 5100 bytes.
  • Newlines are made with CR+LF sequence.

Version:
$Revision: 3 $
Author:
Eric Farng

Constructor Summary
Lyrics3v1()
          Creates a new Lyrics3v1 object.
Lyrics3v1(AbstractMP3Tag mp3Tag)
          Creates a new Lyrics3v1 object.
Lyrics3v1(Lyrics3v1 copyObject)
          Creates a new Lyrics3v1 object.
Lyrics3v1(java.io.RandomAccessFile file)
          Creates a new Lyrics3v1 object.
 
Method Summary
 void append(AbstractMP3Tag tag)
          This method does nothing, but is called by subclasses for completeness
 boolean equals(java.lang.Object obj)
          Determines whether another object is equal to this tag.
 java.lang.String getAlbumTitle()
          Get the song's album title.
 java.lang.String getAuthorComposer()
          Get the author/composer.
 java.lang.String getIdentifier()
           
 java.lang.String getLeadArtist()
          Get the lead artist.
 java.lang.String getLyric()
           
 int getSize()
           
 java.lang.String getSongComment()
          Get a song comment.
 java.lang.String getSongGenre()
          Get the genre.
 java.lang.String getSongLyric()
          Get the song lyrics.
 java.lang.String getSongTitle()
          Get the song title.
 java.lang.String getTrackNumberOnAlbum()
          Get the track number.
 java.lang.String getYearReleased()
          Get the year the song was released.
 boolean isSubsetOf(java.lang.Object object)
          Returns true if this object is a subset of the argument.
 java.util.Iterator iterator()
          Get an iterator over all tags available.
 void overwrite(AbstractMP3Tag tag)
          This method does nothing, but is called by subclasses for completeness
 void read(java.io.RandomAccessFile file)
          import java.io.IOException; import java.io.RandomAccessFile; read from current file pointer position.
 boolean seek(java.io.RandomAccessFile file)
          Looks for this tag.
 void setAlbumTitle(java.lang.String albumTitle)
           
 void setAuthorComposer(java.lang.String authorComposer)
           
 void setLeadArtist(java.lang.String leadArtist)
           
 void setLyric(java.lang.String lyric)
           
 void setSongComment(java.lang.String songComment)
           
 void setSongGenre(java.lang.String songGenre)
           
 void setSongLyric(java.lang.String songLyrics)
           
 void setSongTitle(java.lang.String songTitle)
           
 void setTrackNumberOnAlbum(java.lang.String trackNumberOnAlbum)
           
 void setYearReleased(java.lang.String yearReleased)
           
 java.lang.String toString()
           
 void write(AbstractMP3Tag tag)
          This method does nothing, but is called by subclasses for completeness
 void write(java.io.RandomAccessFile file)
          Method to write this object to the file argument at is current file pointer position.
 
Methods inherited from class org.farng.mp3.lyrics3.AbstractLyrics3
append, delete, overwrite
 
Methods inherited from class org.farng.mp3.AbstractMP3Tag
isSubsetOf
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Lyrics3v1

public Lyrics3v1()
Creates a new Lyrics3v1 object.


Lyrics3v1

public Lyrics3v1(Lyrics3v1 copyObject)
Creates a new Lyrics3v1 object.


Lyrics3v1

public Lyrics3v1(AbstractMP3Tag mp3Tag)
Creates a new Lyrics3v1 object.


Lyrics3v1

public Lyrics3v1(java.io.RandomAccessFile file)
          throws TagNotFoundException,
                 java.io.IOException
Creates a new Lyrics3v1 object.

Throws:
TagNotFoundException
java.io.IOException
Method Detail

getIdentifier

public java.lang.String getIdentifier()
Specified by:
getIdentifier in class AbstractMP3FileItem

setLyric

public void setLyric(java.lang.String lyric)

getLyric

public java.lang.String getLyric()

getSize

public int getSize()
Specified by:
getSize in class AbstractMP3FileItem

isSubsetOf

public boolean isSubsetOf(java.lang.Object object)
Description copied from class: AbstractMP3FileItem
Returns true if this object is a subset of the argument. This instance is a subset if it is the same class as the argument.

Overrides:
isSubsetOf in class AbstractMP3FileItem
Parameters:
object - object to determine subset of
Returns:
true if this instance and its entire object array list is a subset of the argument.

append

public void append(AbstractMP3Tag tag)
Description copied from class: AbstractMP3Tag
This method does nothing, but is called by subclasses for completeness

Specified by:
append in class AbstractMP3Tag
Parameters:
tag - tag to overwrite

equals

public boolean equals(java.lang.Object obj)
Description copied from class: AbstractMP3Tag
Determines whether another object is equal to this tag. It just compares if they are the same class, then calls super.equals(object).

Overrides:
equals in class AbstractMP3Tag
Parameters:
obj - object to determine equality of
Returns:
true if this object and its body are equal

iterator

public java.util.Iterator iterator()
Description copied from interface: MP3Tag
Get an iterator over all tags available.

Returns:
iterator

overwrite

public void overwrite(AbstractMP3Tag tag)
Description copied from class: AbstractMP3Tag
This method does nothing, but is called by subclasses for completeness

Specified by:
overwrite in class AbstractMP3Tag
Parameters:
tag - tag to overwrite

read

public void read(java.io.RandomAccessFile file)
          throws TagNotFoundException,
                 java.io.IOException
Description copied from class: AbstractMP3FileItem
import java.io.IOException; import java.io.RandomAccessFile; read from current file pointer position.

Specified by:
read in class AbstractMP3FileItem
Parameters:
file - file to read from
Throws:
java.io.IOException - on any I/O error
TagNotFoundException

seek

public boolean seek(java.io.RandomAccessFile file)
             throws java.io.IOException
Description copied from class: AbstractMP3Tag
Looks for this tag. returns true if found. If found, the file pointer is right after the tag start indicator i.e. "TAG" "LYRICSBEGIN" "ID3" + 2

Specified by:
seek in class AbstractMP3Tag
Parameters:
file - MP3 file to overwrite
Returns:
returns true if found, false otherwise.
Throws:
java.io.IOException - on any I/O error

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

write

public void write(AbstractMP3Tag tag)
Description copied from class: AbstractMP3Tag
This method does nothing, but is called by subclasses for completeness

Specified by:
write in class AbstractMP3Tag
Parameters:
tag - tag to write to

write

public void write(java.io.RandomAccessFile file)
           throws java.io.IOException
Description copied from class: AbstractMP3FileItem
Method to write this object to the file argument at is current file pointer position.

Specified by:
write in class AbstractMP3FileItem
Parameters:
file - file to write to
Throws:
java.io.IOException - on any I/O error

getSongTitle

public java.lang.String getSongTitle()
Description copied from interface: MP3Tag
Get the song title.

Returns:
song title

getLeadArtist

public java.lang.String getLeadArtist()
Description copied from interface: MP3Tag
Get the lead artist.

Returns:
lead artist

getAlbumTitle

public java.lang.String getAlbumTitle()
Description copied from interface: MP3Tag
Get the song's album title.

Returns:
album title

getYearReleased

public java.lang.String getYearReleased()
Description copied from interface: MP3Tag
Get the year the song was released.

Returns:
year

getSongComment

public java.lang.String getSongComment()
Description copied from interface: MP3Tag
Get a song comment.

Returns:
comment

getSongGenre

public java.lang.String getSongGenre()
Description copied from interface: MP3Tag
Get the genre.

Returns:
genre

getTrackNumberOnAlbum

public java.lang.String getTrackNumberOnAlbum()
Description copied from interface: MP3Tag
Get the track number.

Returns:
track number

getSongLyric

public java.lang.String getSongLyric()
Description copied from interface: MP3Tag
Get the song lyrics.

Returns:
song lyrics

getAuthorComposer

public java.lang.String getAuthorComposer()
Description copied from interface: MP3Tag
Get the author/composer.

Returns:
author/composer

setSongTitle

public void setSongTitle(java.lang.String songTitle)
Specified by:
setSongTitle in class AbstractMP3Tag

setLeadArtist

public void setLeadArtist(java.lang.String leadArtist)
Specified by:
setLeadArtist in class AbstractMP3Tag

setAlbumTitle

public void setAlbumTitle(java.lang.String albumTitle)
Specified by:
setAlbumTitle in class AbstractMP3Tag

setYearReleased

public void setYearReleased(java.lang.String yearReleased)
Specified by:
setYearReleased in class AbstractMP3Tag

setSongComment

public void setSongComment(java.lang.String songComment)
Specified by:
setSongComment in class AbstractMP3Tag

setSongGenre

public void setSongGenre(java.lang.String songGenre)
Specified by:
setSongGenre in class AbstractMP3Tag

setTrackNumberOnAlbum

public void setTrackNumberOnAlbum(java.lang.String trackNumberOnAlbum)
Specified by:
setTrackNumberOnAlbum in class AbstractMP3Tag

setSongLyric

public void setSongLyric(java.lang.String songLyrics)
Specified by:
setSongLyric in class AbstractMP3Tag

setAuthorComposer

public void setAuthorComposer(java.lang.String authorComposer)
Specified by:
setAuthorComposer in class AbstractMP3Tag