*/
public ID3v2_4Frame(final Lyrics3v2Field field) throws InvalidTagException {
final String id = field.getIdentifier();
final String value;
if (id.equals("IND")) {
throw new InvalidTagException("Cannot create ID3v2.40 frame from Lyrics3 indications field.");
} else if (id.equals("LYR")) {
final FieldBodyLYR lyric = (FieldBodyLYR) field.getBody();
ObjectLyrics3Line line;
final Iterator iterator = lyric.iterator();
final FrameBodySYLT sync;
final FrameBodyUSLT unsync;
final boolean hasTimeStamp = lyric.hasTimeStamp();
// we'll create only one frame here.
// if there is any timestamp at all, we will create a sync'ed frame.
sync = new FrameBodySYLT((byte) 0, "ENG", (byte) 2, (byte) 1, "");
unsync = new FrameBodyUSLT((byte) 0, "ENG", "", "");
while (iterator.hasNext()) {
line = (ObjectLyrics3Line) iterator.next();
if (hasTimeStamp) {
sync.addLyric(line);
} else {
unsync.addLyric(line);
}
}
if (hasTimeStamp) {
this.setBody(sync);
} else {
this.setBody(unsync);
}
} else if (id.equals("INF")) {
value = ((FieldBodyINF) field.getBody()).getAdditionalInformation();
this.setBody(new FrameBodyCOMM((byte) 0, "ENG", "", value));
} else if (id.equals("AUT")) {
value = ((FieldBodyAUT) field.getBody()).getAuthor();
this.setBody(new FrameBodyTCOM((byte) 0, value));
} else if (id.equals("EAL")) {
value = ((FieldBodyEAL) field.getBody()).getAlbum();
this.setBody(new FrameBodyTALB((byte) 0, value));
} else if (id.equals("EAR")) {
value = ((FieldBodyEAR) field.getBody()).getArtist();
this.setBody(new FrameBodyTPE1((byte) 0, value));
} else if (id.equals("ETT")) {
value = ((FieldBodyETT) field.getBody()).getTitle();
this.setBody(new FrameBodyTIT2((byte) 0, value));
} else if (id.equals("IMG")) {
throw new InvalidTagException("Cannot create ID3v2.40 frame from Lyrics3 image field.");
} else {
throw new InvalidTagException("Cannot caret ID3v2.40 frame from " + id + " Lyrics3 field");
}
}