* use MetaAttributes for matching only when enabled via system properties
This commit is contained in:
parent
01f54f8e86
commit
bfe4add9ab
|
@ -27,15 +27,19 @@ public class CrossPropertyMetric implements SimilarityMetric {
|
|||
@Override
|
||||
public float getSimilarity(Object o1, Object o2) {
|
||||
Map<String, Object> m1 = getProperties(o1);
|
||||
Map<String, Object> m2 = getProperties(o2);
|
||||
if (m1.isEmpty())
|
||||
return 0;
|
||||
|
||||
Map<String, Object> m2 = getProperties(o2);
|
||||
if (m2.isEmpty())
|
||||
return 0;
|
||||
|
||||
// works with commons keys
|
||||
Set<String> keys = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
|
||||
keys.addAll(m1.keySet());
|
||||
keys.retainAll(m2.keySet());
|
||||
|
||||
if (keys.isEmpty()) {
|
||||
if (keys.isEmpty())
|
||||
return 0;
|
||||
}
|
||||
|
||||
float feedback = 0;
|
||||
for (String k : keys) {
|
||||
|
|
|
@ -5,6 +5,7 @@ package net.sourceforge.filebot.similarity;
|
|||
import static java.lang.Math.*;
|
||||
import static java.util.Arrays.*;
|
||||
import static java.util.Collections.*;
|
||||
import static net.sourceforge.filebot.Settings.*;
|
||||
import static net.sourceforge.filebot.similarity.Normalization.*;
|
||||
import static net.sourceforge.tuned.FileUtilities.*;
|
||||
|
||||
|
@ -320,8 +321,8 @@ public enum EpisodeMetrics implements SimilarityMetric {
|
|||
return super.getProperties(object);
|
||||
}
|
||||
|
||||
// deserialize MetaAttributes if available
|
||||
if (object instanceof File) {
|
||||
// deserialize MetaAttributes if enabled and available
|
||||
if (object instanceof File && useExtendedFileAttributes()) {
|
||||
try {
|
||||
return super.getProperties(new net.sourceforge.filebot.media.MetaAttributes((File) object).getMetaData());
|
||||
} catch (Throwable e) {
|
||||
|
|
Loading…
Reference in New Issue