* allow 0000-2999 SSEE patterns

@see http://www.filebot.net/forums/viewtopic.php?f=6&t=907
This commit is contained in:
Reinhard Pointner 2013-08-31 06:51:30 +00:00
parent 4066124dff
commit 9ff34da4cf
2 changed files with 36 additions and 39 deletions

View File

@ -2,9 +2,11 @@
package net.sourceforge.filebot.similarity;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.util.regex.Pattern.*;
import static java.util.Arrays.asList;
import static java.util.Collections.singleton;
import static java.util.regex.Pattern.CASE_INSENSITIVE;
import static java.util.regex.Pattern.UNICODE_CASE;
import static java.util.regex.Pattern.compile;
import java.io.File;
import java.util.ArrayList;
@ -70,7 +72,7 @@ public class SeasonEpisodeMatcher {
};
// match patterns like 01, 102, 1003 (enclosed in separators)
patterns[4] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum})([0-1]?\\d?)(\\d{2})(?!\\p{Alnum})") {
patterns[4] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum})([0-2]?\\d?)(\\d{2})(?!\\p{Alnum})") {
@Override
protected Collection<SxE> process(MatchResult match) {

View File

@ -1,20 +1,16 @@
package net.sourceforge.filebot.similarity;
import static java.util.Arrays.*;
import static net.sourceforge.filebot.similarity.SeasonEpisodeMatcher.SxE.*;
import static org.junit.Assert.*;
import static java.util.Arrays.asList;
import static net.sourceforge.filebot.similarity.SeasonEpisodeMatcher.SxE.UNDEFINED;
import static org.junit.Assert.assertEquals;
import net.sourceforge.filebot.similarity.SeasonEpisodeMatcher.SxE;
import org.junit.Test;
public class SeasonEpisodeMatcherTest {
private static SeasonEpisodeMatcher matcher = new SeasonEpisodeMatcher(null, false);
@Test
public void patternPrecedence() {
// S01E01 pattern has highest precedence
@ -24,7 +20,6 @@ public class SeasonEpisodeMatcherTest {
assertEquals(new SxE(1, 2), matcher.match("Test.42.s01e01.s01e02.300").get(1));
}
@Test
public void pattern_1x01() {
assertEquals(new SxE(1, 1), matcher.match("1x01").get(0));
@ -39,7 +34,6 @@ public class SeasonEpisodeMatcherTest {
assertEquals(new SxE(1, 3), matcher.match("Test_-_103_[1280x720]").get(0));
}
@Test
public void pattern_S01E01() {
assertEquals(new SxE(1, 1), matcher.match("S01E01").get(0));
@ -55,7 +49,6 @@ public class SeasonEpisodeMatcherTest {
assertEquals(new SxE(12, 345), matcher.match("Test - S12E345 - High Values").get(0));
}
@Test
public void pattern_101() {
assertEquals(new SxE(1, 1), matcher.match("Test.101").get(0));
@ -74,8 +67,10 @@ public class SeasonEpisodeMatcherTest {
// test ambiguous match processing
assertEquals(asList(new SxE(1, 1), new SxE(UNDEFINED, 101)), matcher.match("Test.101"));
}
// test 4-digit
assertEquals(asList(new SxE(23, 21), new SxE(null, 2321)), matcher.match("the.simpsons.2321.hdtv-lol"));
}
@Test
public void multiEpisodePatterns() {