|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.farng.mp3.AbstractMP3FileItem org.farng.mp3.AbstractMP3Tag
File sourceFile; MP3File mp3file = new MP3File(sourceFile);You can also read specific tags:
ID3v1_1 tag = new ID3v1_1(sourceFile); ID3v1 tag = new ID3v1(sourceFile); ID3v2_4 tag = new ID3v2_4(sourceFile); ID3v2_3 tag = new ID3v2_3(sourceFile); ID3v2_2 tag = new ID3v2_2(sourceFile); Lyrics3v2 tag = new Lyrics3v2(sourceFile); Lyrics3v1 tag = new Lyrics3v1(sourceFile);
MP3File mp3file = new MP3File(); TagOptionSingleton.getInstance().setDefaultSaveMode(TagConstant.MP3_FILE_SAVE_OVERWRITE); // setup id3v1 id3v1.setAlbum("albumTitle"); // setup id3v2 AbstractID3v2Frame frame; AbstractID3v2FrameBody frameBody; frameBody = new FrameBodyTALB((byte) 0, "albumTitle"); frame = new ID3v2_4Frame(frameBody); id3v2.setFrame(frame); // setup lyrics3v2 Lyrics3v2Field field; AbstractLyrics3v2FieldBody fieldBody; fieldBody = new FieldBodyEAL("albumTitle"); field = new Lyrics3v2Field(fieldBody); lyrics3.setField(field); // setup filename tag frameBody = new FrameBodyTALB((byte) 0, "albumTitle"); frame = new ID3v2_4Frame(frameBody); filenameId3.setFrame(frame); TagOptionSingleton.getInstance().setFilenameTagSave(true);Things to note:
public abstract String getSongTitle(); public abstract String getLeadArtist(); public abstract String getAlbumTitle(); public abstract String getYearReleased(); public abstract String getSongComment(); public abstract String getSongGenre(); public abstract String getTrackNumberOnAlbum(); public abstract String getSongLyric(); public abstract String getAuthorComposer(); public abstract void setSongTitle(String songTitle); public abstract void setLeadArtist(String leadArtist); public abstract void setAlbumTitle(String albumTitle); public abstract void setYearReleased(String yearReleased); public abstract void setSongComment(String songComment); public abstract void setSongGenre(String songGenre); public abstract void setTrackNumberOnAlbum(String trackNumberOnAlbum); public abstract void setSongLyric(String songLyrics); public abstract void setAuthorComposer(String authorComposer);
id3v1 = mp3file.getID3v1Tag(); id3v2 = mp3file.getID3v2Tag(); lyrics3 = mp3file.getLyrics3Tag();ID3v1 tags have fixed fields and use accessor methods to change it's properties.
ID3v2 tags have multiple frames. Use this to set the title of the tag.
frame = id3v2.getFrame("TIT2"); ((FrameBodyTIT2) frame.getBody()).setText("New Title");
Lyrics3 tags have multiple fields. Use this to set the title of the tag.
field = lyrics3.getField("ETT"); ((FieldBodyETT) field.getBody()).setTitle("New Title");
mp3file.save();You can also save each individual tag through each tags' save() method.
Constructor Summary | |
protected |
AbstractMP3Tag()
Creates a new AbstractMP3Tag object. |
protected |
AbstractMP3Tag(AbstractMP3Tag copyObject)
Creates a new AbstractMP3Tag object. |
Method Summary | |
abstract void |
append(AbstractMP3Tag abstractMP3Tag)
This method does nothing, but is called by subclasses for completeness |
abstract void |
append(java.io.RandomAccessFile file)
Appends this tag to the given file. |
abstract void |
delete(java.io.RandomAccessFile file)
removes the specific tag the easiest way. |
boolean |
equals(java.lang.Object obj)
Determines whether another object is equal to this tag. |
abstract java.lang.String |
getAlbumTitle()
|
abstract java.lang.String |
getAuthorComposer()
|
abstract java.lang.String |
getLeadArtist()
|
abstract java.lang.String |
getSongComment()
|
abstract java.lang.String |
getSongGenre()
|
abstract java.lang.String |
getSongLyric()
|
abstract java.lang.String |
getSongTitle()
|
abstract java.lang.String |
getTrackNumberOnAlbum()
|
abstract java.lang.String |
getYearReleased()
|
boolean |
isSubsetOf(AbstractMP3Tag abstractMP3Tag)
Returns true if this tag is a subset of the argument. |
abstract java.util.Iterator |
iterator()
|
abstract void |
overwrite(AbstractMP3Tag abstractMP3Tag)
This method does nothing, but is called by subclasses for completeness |
abstract void |
overwrite(java.io.RandomAccessFile file)
Overwrites this tag to the given file. |
abstract boolean |
seek(java.io.RandomAccessFile file)
Looks for this tag. |
abstract void |
setAlbumTitle(java.lang.String albumTitle)
|
abstract void |
setAuthorComposer(java.lang.String authorComposer)
|
abstract void |
setLeadArtist(java.lang.String leadArtist)
|
abstract void |
setSongComment(java.lang.String songComment)
|
abstract void |
setSongGenre(java.lang.String songGenre)
|
abstract void |
setSongLyric(java.lang.String songLyrics)
|
abstract void |
setSongTitle(java.lang.String songTitle)
|
abstract void |
setTrackNumberOnAlbum(java.lang.String trackNumberOnAlbum)
|
abstract void |
setYearReleased(java.lang.String yearReleased)
|
abstract void |
write(AbstractMP3Tag abstractMP3Tag)
This method does nothing, but is called by subclasses for completeness |
Methods inherited from class org.farng.mp3.AbstractMP3FileItem |
getIdentifier, getSize, isSubsetOf, read, write |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected AbstractMP3Tag()
protected AbstractMP3Tag(AbstractMP3Tag copyObject)
Method Detail |
public abstract void append(java.io.RandomAccessFile file) throws java.io.IOException, TagException
file
- MP3 file to append to.
java.io.IOException
- on any I/O error
TagException
- on any exception generated by this library.public abstract void delete(java.io.RandomAccessFile file) throws java.io.IOException
file
- MP3 file to append to.
java.io.IOException
- on any I/O errorpublic abstract void overwrite(java.io.RandomAccessFile file) throws java.io.IOException, TagException
file
- MP3 file to overwrite
java.io.IOException
- on any I/O error
TagException
- on any exception generated by this library.public abstract boolean seek(java.io.RandomAccessFile file) throws java.io.IOException
file
- MP3 file to overwrite
java.io.IOException
- on any I/O errorpublic boolean isSubsetOf(AbstractMP3Tag abstractMP3Tag)
abstractMP3Tag
- superset tag
public abstract void append(AbstractMP3Tag abstractMP3Tag)
abstractMP3Tag
- tag to overwritepublic boolean equals(java.lang.Object obj)
super.equals(object)
.
equals
in class AbstractMP3FileItem
obj
- object to determine equality of
public abstract java.util.Iterator iterator()
public abstract void overwrite(AbstractMP3Tag abstractMP3Tag)
abstractMP3Tag
- tag to overwritepublic abstract void write(AbstractMP3Tag abstractMP3Tag)
abstractMP3Tag
- tag to write topublic abstract java.lang.String getSongTitle()
public abstract java.lang.String getLeadArtist()
public abstract java.lang.String getAlbumTitle()
public abstract java.lang.String getYearReleased()
public abstract java.lang.String getSongComment()
public abstract java.lang.String getSongGenre()
public abstract java.lang.String getTrackNumberOnAlbum()
public abstract java.lang.String getSongLyric()
public abstract java.lang.String getAuthorComposer()
public abstract void setSongTitle(java.lang.String songTitle)
public abstract void setLeadArtist(java.lang.String leadArtist)
public abstract void setAlbumTitle(java.lang.String albumTitle)
public abstract void setYearReleased(java.lang.String yearReleased)
public abstract void setSongComment(java.lang.String songComment)
public abstract void setSongGenre(java.lang.String songGenre)
public abstract void setTrackNumberOnAlbum(java.lang.String trackNumberOnAlbum)
public abstract void setSongLyric(java.lang.String songLyrics)
public abstract void setAuthorComposer(java.lang.String authorComposer)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |