From b6c2329e795cf8e8956a54a8570ff09ccf05e4ff Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 22 Nov 2016 07:01:51 +0800 Subject: [PATCH] Improved support for absolute multi-episode patterns @see https://www.filebot.net/forums/viewtopic.php?f=10&t=4371&p=24494#p24485 --- source/net/filebot/similarity/SeasonEpisodeMatcher.java | 6 +++--- test/net/filebot/similarity/SeasonEpisodeMatcherTest.java | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/net/filebot/similarity/SeasonEpisodeMatcher.java b/source/net/filebot/similarity/SeasonEpisodeMatcher.java index c91830a3..b7b7225e 100644 --- a/source/net/filebot/similarity/SeasonEpisodeMatcher.java +++ b/source/net/filebot/similarity/SeasonEpisodeMatcher.java @@ -65,8 +65,8 @@ public class SeasonEpisodeMatcher { }); // match patterns like ep1, ep.1, ... - EP0 = new SeasonEpisodePattern(sanity, "(? { - return single(m.group(1), m.group(2)); + EP0 = new SeasonEpisodePattern(sanity, "(? { + return multi(m.group(1), m.group(2)); }); // match patterns like 01, 102, 1003, 10102 (enclosed in separators) @@ -100,7 +100,7 @@ public class SeasonEpisodeMatcher { } protected List multi(String season, String... episodes) { - int s = Integer.parseInt(season); + Integer s = matchInteger(season); return stream(episodes).flatMap(e -> matchIntegers(e).stream()).map(e -> new SxE(s, e)).collect(toList()); } diff --git a/test/net/filebot/similarity/SeasonEpisodeMatcherTest.java b/test/net/filebot/similarity/SeasonEpisodeMatcherTest.java index 5e960b8e..5e19c32c 100644 --- a/test/net/filebot/similarity/SeasonEpisodeMatcherTest.java +++ b/test/net/filebot/similarity/SeasonEpisodeMatcherTest.java @@ -107,6 +107,8 @@ public class SeasonEpisodeMatcherTest { assertEquals(new SxE(1, 1), matcher.match("1x01.1x02.1x03.1x04").get(0)); assertEquals(new SxE(1, 4), matcher.match("1x01.1x02.1x03.1x04").get(3)); + + assertEquals(new SxE(null, 4), matcher.match("E1E2E3E4").get(3)); } @Test