diff --git a/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java b/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java index eba8ab2a..29a0d3c6 100644 --- a/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java +++ b/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java @@ -1,7 +1,6 @@ package net.sourceforge.filebot.similarity; import static java.lang.Math.*; -import static java.util.Arrays.*; import static java.util.Collections.*; import static java.util.regex.Pattern.*; import static net.sourceforge.filebot.Settings.*; @@ -62,15 +61,22 @@ public enum EpisodeMetrics implements SimilarityMetric { if (object instanceof Episode) { Episode episode = (Episode) object; - if (episode.getSpecial() != null) { - return singleton(new SxE(0, episode.getSpecial())); - } - // 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()); + Set sxe = new HashSet(2); - result = (abs.episode < 0 || sxe.equals(abs)) ? singleton(sxe) : asList(sxe, abs); + // default SxE numbering + if (episode.getEpisode() != null) { + sxe.add(new SxE(episode.getSeason(), episode.getEpisode())); + } + // absolute numbering + if (episode.getAbsolute() != null) { + sxe.add(new SxE(null, episode.getAbsolute())); + } + // 0xSpecial numbering + if (episode.getSpecial() != null) { + sxe.add(new SxE(0, episode.getSpecial())); + } + result = sxe; } else { result = super.parse(object); } diff --git a/source/net/sourceforge/filebot/similarity/SeasonEpisodeMatcher.java b/source/net/sourceforge/filebot/similarity/SeasonEpisodeMatcher.java index 8f6086e5..5d39e337 100644 --- a/source/net/sourceforge/filebot/similarity/SeasonEpisodeMatcher.java +++ b/source/net/sourceforge/filebot/similarity/SeasonEpisodeMatcher.java @@ -90,10 +90,12 @@ public class SeasonEpisodeMatcher { protected Collection process(MatchResult match) { Set sxe = new LinkedHashSet(2); - // interpret match as season and episode - for (int i = 2; i <= match.groupCount(); i++) { - if (match.group(i) != null) { - sxe.add(new SxE(match.group(1), match.group(i))); + // interpret match as season and episode, but ignore 001 => 0x01 Season 0 matches + if (match.group(1).length() > 0 && Integer.parseInt(match.group(1)) > 0) { + for (int i = 2; i <= match.groupCount(); i++) { + if (match.group(i) != null) { + sxe.add(new SxE(match.group(1), match.group(i))); + } } }