org.farng.mp3.lyrics3
Class Lyrics3v1

java.lang.Object
  extended byorg.farng.mp3.AbstractMP3FileItem
      extended byorg.farng.mp3.AbstractMP3Tag
          extended byorg.farng.mp3.lyrics3.AbstractLyrics3
              extended byorg.farng.mp3.lyrics3.Lyrics3v1

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: 1.5 $
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()
           
 java.lang.String getAuthorComposer()
           
 java.lang.String getIdentifier()
          ID string that usually corresponds to the class name, but can be displayed to the user.
 java.lang.String getLeadArtist()
           
 java.lang.String getLyric()
           
 int getSize()
           
 java.lang.String getSongComment()
           
 java.lang.String getSongGenre()
           
 java.lang.String getSongLyric()
           
 java.lang.String getSongTitle()
           
 java.lang.String getTrackNumberOnAlbum()
           
 java.lang.String getYearReleased()
           
 boolean isSubsetOf(java.lang.Object object)
          Returns true if this object is a subset of the argument.
 java.util.Iterator iterator()
           
 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.

Method Detail

getIdentifier

public java.lang.String getIdentifier()
Description copied from class: AbstractMP3FileItem
ID string that usually corresponds to the class name, but can be displayed to the user. It is not indended to identify each individual instance.

Specified by:
getIdentifier in class AbstractMP3FileItem
Returns:
ID string

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

iterator

public java.util.Iterator iterator()
Specified by:
iterator in class AbstractMP3Tag

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()

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()
Specified by:
getSongTitle in class AbstractMP3Tag

getLeadArtist

public java.lang.String getLeadArtist()
Specified by:
getLeadArtist in class AbstractMP3Tag

getAlbumTitle

public java.lang.String getAlbumTitle()
Specified by:
getAlbumTitle in class AbstractMP3Tag

getYearReleased

public java.lang.String getYearReleased()
Specified by:
getYearReleased in class AbstractMP3Tag

getSongComment

public java.lang.String getSongComment()
Specified by:
getSongComment in class AbstractMP3Tag

getSongGenre

public java.lang.String getSongGenre()
Specified by:
getSongGenre in class AbstractMP3Tag

getTrackNumberOnAlbum

public java.lang.String getTrackNumberOnAlbum()
Specified by:
getTrackNumberOnAlbum in class AbstractMP3Tag

getSongLyric

public java.lang.String getSongLyric()
Specified by:
getSongLyric in class AbstractMP3Tag

getAuthorComposer

public java.lang.String getAuthorComposer()
Specified by:
getAuthorComposer in class AbstractMP3Tag

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


Copyright (c) 2004 Eric Farng