From f1114f365a93a697b0ae1ebefc74f795ae58f2c2 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 9 Sep 2015 08:33:33 +0000 Subject: [PATCH] * allow for continuous SxE sequences, e.g. S02E05-E08 --- .../filebot/similarity/SeasonEpisodeMatcher.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source/net/filebot/similarity/SeasonEpisodeMatcher.java b/source/net/filebot/similarity/SeasonEpisodeMatcher.java index 43015cde..34faeb1b 100644 --- a/source/net/filebot/similarity/SeasonEpisodeMatcher.java +++ b/source/net/filebot/similarity/SeasonEpisodeMatcher.java @@ -333,6 +333,22 @@ public class SeasonEpisodeMatcher { } } + return expandSequence(matches); + } + + protected List expandSequence(List matches) { + // allow for continuous SxE sequences, e.g. S02E05-E08 + if (matches.size() == 2) { + SxE start = matches.get(0); + SxE end = matches.get(1); + if (start.season == end.season && start.episode < end.episode) { + List seq = new ArrayList(); + for (int i = start.episode; i <= end.episode; i++) { + seq.add(new SxE(start.season, i)); + } + return seq; + } + } return matches; }