if (mp3File.hasId3v1Tag()) {
mp3File.removeId3v1Tag();
}
// Get/create id3v2 tag
ID3v2 id3v2Tag;
if (mp3File.hasId3v2Tag()) {
id3v2Tag = mp3File.getId3v2Tag();
} else {
id3v2Tag = new ID3v23Tag();
}
Exception err = null;
while (true) {
// Try saving twice; once with old tag data, and again after
// discarding corrupt data and starting over
try {
id3v2Tag.setTitle(song.getName());
id3v2Tag.setArtist(song.getArtistName());
id3v2Tag.setAlbum(song.getAlbumName());
id3v2Tag.setYear(song.getYear() + "");
Utils.encodeId(song.getId(), id3v2Tag);
mp3File.setId3v2Tag(id3v2Tag);
mp3File.save(tempFile2.getAbsolutePath());
break;
} catch (NotSupportedException e) {