diff --git a/source/net/sourceforge/filebot/similarity/CrossPropertyMetric.java b/source/net/sourceforge/filebot/similarity/CrossPropertyMetric.java index 333d1df7..8a6a8608 100644 --- a/source/net/sourceforge/filebot/similarity/CrossPropertyMetric.java +++ b/source/net/sourceforge/filebot/similarity/CrossPropertyMetric.java @@ -27,15 +27,19 @@ public class CrossPropertyMetric implements SimilarityMetric { @Override public float getSimilarity(Object o1, Object o2) { Map m1 = getProperties(o1); - Map m2 = getProperties(o2); + if (m1.isEmpty()) + return 0; + Map m2 = getProperties(o2); + if (m2.isEmpty()) + return 0; + + // works with commons keys Set keys = new TreeSet(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) { diff --git a/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java b/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java index b01fd551..469ea20a 100644 --- a/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java +++ b/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java @@ -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) {