* fine-tune PartX patterns

This commit is contained in:
Reinhard Pointner 2013-11-03 09:20:35 +00:00
parent 64b74ac417
commit 13a694aa6f
2 changed files with 5 additions and 1 deletions

View File

@ -72,7 +72,7 @@ public class SeasonEpisodeMatcher {
}; };
// match patterns like ep1, ep.1, ... // match patterns like ep1, ep.1, ...
patterns[4] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum})(\\d{2}|\\d{4})?[^\\p{Alnum}]{0,3}(?i:e|p|ep|episode)[^\\p{Alnum}]{0,3}(\\d{1,3})(?!\\p{Digit})") { patterns[4] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum})(\\d{2}|\\d{4})?[^\\p{Alnum}]{0,3}(?i:e|ep|episode|p|part)[^\\p{Alnum}]{0,3}(\\d{1,3})(?!\\p{Digit})") {
@Override @Override
protected Collection<SxE> process(MatchResult match) { protected Collection<SxE> process(MatchResult match) {

View File

@ -18,6 +18,10 @@ public class SeasonEpisodeMatcherTest {
assertEquals(new SxE(1, 2), matcher.match("[s01]_[e02]").get(0)); assertEquals(new SxE(1, 2), matcher.match("[s01]_[e02]").get(0));
assertEquals(new SxE(2013, 10), matcher.match("2013.P10").get(0)); assertEquals(new SxE(2013, 10), matcher.match("2013.P10").get(0));
assertEquals(new SxE(2013, 10), matcher.match("2013.P10").get(0));
assertEquals(new SxE(null, 11), matcher.match("wsop.2013.me.p11.720p-yestv").get(0));
assertEquals(new SxE(null, 18), matcher.match("World.Series.Of.Poker.2013.Main.Event.Part18.480p.HDTV.x264-mSD").get(0));
// multiple values // multiple values
assertEquals(new SxE(1, 2), matcher.match("Test.42.s01e01.s01e02.300").get(1)); assertEquals(new SxE(1, 2), matcher.match("Test.42.s01e01.s01e02.300").get(1));