}
for (TagField field : fields) {
ID3v24Frame frame = (ID3v24Frame) field;
if (frame.getBody() instanceof FrameBodyTRCK) {
FrameBodyTRCK body = (FrameBodyTRCK) frame.getBody();
if (FieldKey.TRACK.equals(key)) {
track.getTrackData().addTrack(body.getTrackNo());
}
else if (FieldKey.TRACK_TOTAL.equals(key)) {
track.getTrackData().addTrackTotal(body.getTrackTotal());
}
}
else if (frame.getBody() instanceof FrameBodyTPOS) {
FrameBodyTPOS body = (FrameBodyTPOS) frame.getBody();
if (FieldKey.DISC_NO.equals(key)) {
track.getTrackData().addDisc(body.getDiscNo());
}
else if (FieldKey.DISC_TOTAL.equals(key)) {
track.getTrackData().addDiscTotal(body.getDiscTotal());
}
}
else if (frame.getBody() instanceof FrameBodyCOMM) {
FrameBodyCOMM body = (FrameBodyCOMM) frame.getBody();
track.getTrackData().addComment(body.getText());
}
else if (frame.getBody() instanceof FrameBodyPOPM) {
FrameBodyPOPM body = (FrameBodyPOPM) frame.getBody();
track.getTrackData().addRating(String.valueOf(body.getRating()));
}
else if (frame.getBody() instanceof AbstractFrameBodyTextInfo) {
AbstractFrameBodyTextInfo body = (AbstractFrameBodyTextInfo) frame.getBody();
for (int i = 0; i < body.getNumberOfValues(); i++) {
track.getTrackData().addTagFieldValues(key, body.getValueAtIndex(i));
}
}
}
}