diff --git a/source/net/sourceforge/filebot/similarity/SeasonEpisodeMatcher.java b/source/net/sourceforge/filebot/similarity/SeasonEpisodeMatcher.java index c03006eb..7c17c0ac 100644 --- a/source/net/sourceforge/filebot/similarity/SeasonEpisodeMatcher.java +++ b/source/net/sourceforge/filebot/similarity/SeasonEpisodeMatcher.java @@ -2,10 +2,12 @@ package net.sourceforge.filebot.similarity; +import static java.util.Arrays.*; +import static java.util.Collections.*; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.List; import java.util.regex.MatchResult; import java.util.regex.Matcher; @@ -18,7 +20,7 @@ public class SeasonEpisodeMatcher { public SeasonEpisodeMatcher(SeasonEpisodeFilter sanity, boolean strict) { - patterns = new SeasonEpisodePattern[3]; + patterns = new SeasonEpisodePattern[4]; // match patterns like S01E01, s01e02, ... [s01]_[e02], s01.e02, s01e02a, s2010e01 ... patterns[0] = new SeasonEpisodePattern(sanity, "(? process(MatchResult match) { + // regex doesn't match season + return singleton(new SxE(null, match.group(1))); + } + }; + // match patterns like 01, 102, 1003 (enclosed in separators) - patterns[2] = new SeasonEpisodePattern(sanity, "(? process(MatchResult match) { @@ -38,7 +50,7 @@ public class SeasonEpisodeMatcher { SxE absoluteEpisode = new SxE(null, match.group(1) + match.group(2)); // return both matches, unless they are one and the same - return seasonEpisode.equals(absoluteEpisode) ? Collections.singleton(seasonEpisode) : Arrays.asList(seasonEpisode, absoluteEpisode); + return seasonEpisode.equals(absoluteEpisode) ? singleton(seasonEpisode) : asList(seasonEpisode, absoluteEpisode); } }; @@ -190,7 +202,7 @@ public class SeasonEpisodeMatcher { protected Collection process(MatchResult match) { - return Collections.singleton(new SxE(match.group(1), match.group(2))); + return singleton(new SxE(match.group(1), match.group(2))); }