From ffa1783e30f4e572cd83faaab1dc4314ab32b6c6 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 21 Jul 2012 15:47:49 +0000 Subject: [PATCH] * make sure specials can't take priority over normal episodes --- .../filebot/similarity/EpisodeMetrics.java | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java b/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java index ec9e72a6..3e1d0068 100644 --- a/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java +++ b/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java @@ -43,19 +43,15 @@ public enum EpisodeMetrics implements SimilarityMetric { if (object instanceof Episode) { Episode episode = (Episode) object; - if (episode.getSpecial() == null) { - // get SxE from episode, both SxE for season/episode numbering and SxE for absolute episode numbering - SxE sxe = new SxE(episode.getSeason(), episode.getEpisode()); - SxE abs = new SxE(null, episode.getAbsolute()); - - result = (abs.episode < 0 || sxe.equals(abs)) ? singleton(sxe) : asList(sxe, abs); - } else { - // special handling - SxE sxe = new SxE(0, episode.getSpecial()); - SxE sne = new SxE(episode.getSeason(), null); - - return asList(sxe, sne); + if (episode.getSpecial() != null) { + return emptySet(); // make sure specials can't take priority over normal episodes } + + // get SxE from episode, both SxE for season/episode numbering and SxE for absolute episode numbering + SxE sxe = new SxE(episode.getSeason(), episode.getEpisode()); + SxE abs = new SxE(null, episode.getAbsolute()); + + result = (abs.episode < 0 || sxe.equals(abs)) ? singleton(sxe) : asList(sxe, abs); } else { result = super.parse(object); } @@ -227,6 +223,7 @@ public enum EpisodeMetrics implements SimilarityMetric { // Match by generic numeric similarity Numeric(new NumericSimilarityMetric() { + @Override public float getSimilarity(Object o1, Object o2) { String[] f1 = fields(o1); String[] f2 = fields(o2); @@ -304,7 +301,6 @@ public enum EpisodeMetrics implements SimilarityMetric { return metric.getSimilarity(o1, o2); } - private static final Map transformCache = synchronizedMap(new WeakHashMap(64, 4));