I am using the JAudioTagger Library to read the metadata from my music files. I was able to retrieve information but looking over the Tag Mapping Spec http://www.jthink.net/jaudiotagger/tagmapping.html. I am trying to retrieve the MusicBrainz Recording ID and have no idea how to choose that specific one. The MP3 file is either ID3v23 or v24, not sure which one. I tried searching with UFID
and MUSICBRAINZ_TRACK_ID
.
File file = new File("09 Bleeding Out.mp3");
AudioFile mp3 = null;
try {
mp3 = AudioFileIO.read(file);
} catch (CannotReadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (TagException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ReadOnlyFileException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvalidAudioFrameException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Tag tag = mp3.getTag();
System.out.println(tag.getFirst("UFID"));
Iterator<TagField> it = tag.getFields();
while(it.hasNext()) {
System.out.println(it.next());
}
You can use
FieldKey.MUSICBRAINZ_TRACK_ID
- this is the recording ID. It maps toUFID:http://musicbrainz.org
i.e. a field giving the UFID for this track as per MusicBrainz.An alternative may be to use
TXXX:MusicBrainz Recording Id
.Finally, note that this field is not that commonly found in files.