if (null == mime) {
return FileVisitResult.CONTINUE;
}
if (mime.startsWith("audio/")) {
AudioFile af = AudioFileIO.read(path.toFile());
Tag tag = af.getTag();
//System.out.println("###### Lied: "+path);
// default-werte, falls tags unvollständig.
String artist = "NULL";
String album = "NULL";
String title = "NULL";
String track = "NULL";
String genre = "NULL";
try {
track = (tag.getFirst(FieldKey.TRACK));
if ("0".equals(track)) { //falls eingetragener track 0 ist, als null übernehmen
track = "NULL";
}
} catch (NullPointerException e) {/*e.printStackTrace();*/}
try {
artist = tag.getFirst(FieldKey.ARTIST);
} catch (NullPointerException e) {/*e.printStackTrace();*/}
try {
album = tag.getFirst(FieldKey.ALBUM);
} catch (NullPointerException e) {/*e.printStackTrace()*/;}
try {
title = tag.getFirst(FieldKey.TITLE);
} catch (NullPointerException e) {/*e.printStackTrace()*/;}
try {
genre = tag.getFirst(FieldKey.GENRE);
} catch (NullPointerException e) {/*e.printStackTrace()*/;}
// System.out.println("MIME: "+mime);
// System.out.println("Track: "+track);
// System.out.println("Artist: "+artist);
// System.out.println("Album: "+album);