public Track readSingle(Track track) {
TrackData trackData = track.getTrackData();
TextEncoding.getInstanceOf().setDefaultNonUnicode(defaultCharset.name());
ID3Tag.setDefaultEncoding(defaultCharset.name());
MP3File mp3File = null;
try {
mp3File = new MP3File(trackData.getFile(), MP3File.LOAD_ALL, true);
} catch (Exception ignored) {
System.out.println("Couldn't read file: " + trackData.getFile());
}
ID3v24Tag v24Tag = null;
if (mp3File != null) {
try {
v24Tag = mp3File.getID3v2TagAsv24();
if (v24Tag != null) {
copyCommonTagFields(v24Tag, track);
copySpecificTagFields(v24Tag, track);
}
ID3v1Tag id3v1Tag = mp3File.getID3v1Tag();
if (id3v1Tag != null) {
copyCommonTagFields(id3v1Tag, track);
}
} catch (IOException e) {
e.printStackTrace();
}
MP3AudioHeader mp3AudioHeader = mp3File.getMP3AudioHeader();
copyHeaderFields(mp3AudioHeader, track);
long totalSamples = trackData.getTotalSamples();
int enc_delay = GAPLESS_DELAY;