* remove useless code

This commit is contained in:
Reinhard Pointner 2014-08-13 15:56:58 +00:00
parent a9d66da51c
commit 425bfb83ea
1 changed files with 2 additions and 20 deletions

View File

@ -5,16 +5,13 @@ import static net.filebot.util.FileUtilities.*;
import java.awt.Component; import java.awt.Component;
import java.io.File; import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map.Entry; import java.util.Map.Entry;
import net.filebot.similarity.Match; import net.filebot.similarity.Match;
import net.filebot.web.AudioTrack; import net.filebot.web.AudioTrack;
import net.filebot.web.ID3Lookup;
import net.filebot.web.MusicIdentificationService; import net.filebot.web.MusicIdentificationService;
import net.filebot.web.SortOrder; import net.filebot.web.SortOrder;
@ -27,30 +24,15 @@ class AudioFingerprintMatcher implements AutoCompleteMatcher {
} }
@Override @Override
public List<Match<File, ?>> match(List<File> files, SortOrder order, Locale locale, boolean autodetection, Component parent) throws Exception { public List<Match<File, ?>> match(List<File> files, boolean strict, SortOrder order, Locale locale, boolean autodetection, Component parent) throws Exception {
List<Match<File, ?>> matches = new ArrayList<Match<File, ?>>(); List<Match<File, ?>> matches = new ArrayList<Match<File, ?>>();
List<File> audioFiles = filter(files, AUDIO_FILES, VIDEO_FILES); List<File> audioFiles = filter(files, AUDIO_FILES, VIDEO_FILES);
// check audio files against acoustid // check audio files against AcoustID
if (audioFiles.size() > 0) { if (audioFiles.size() > 0) {
for (Entry<File, AudioTrack> it : service.lookup(audioFiles).entrySet()) { for (Entry<File, AudioTrack> it : service.lookup(audioFiles).entrySet()) {
if (it.getKey().exists() && it.getValue() != null) { if (it.getKey().exists() && it.getValue() != null) {
AudioTrack track = it.getValue().clone(); AudioTrack track = it.getValue().clone();
// use AcoustID as default but prefer with ID3 data if available
if (!autodetection) {
AudioTrack id3 = new ID3Lookup().lookup(Collections.singleton(it.getKey())).get(it.getKey());
for (Field field : AudioTrack.class.getDeclaredFields()) {
if (!field.isAccessible()) {
field.setAccessible(true);
}
Object id3value = field.get(id3);
if (id3value != null && !id3value.toString().isEmpty()) {
field.set(track, id3value);
}
}
}
matches.add(new Match<File, AudioTrack>(it.getKey(), track)); matches.add(new Match<File, AudioTrack>(it.getKey(), track));
} }
} }