* allow 0000-2999 SSEE patterns
@see http://www.filebot.net/forums/viewtopic.php?f=6&t=907
This commit is contained in:
parent
4066124dff
commit
9ff34da4cf
|
@ -2,9 +2,11 @@
|
||||||
package net.sourceforge.filebot.similarity;
|
package net.sourceforge.filebot.similarity;
|
||||||
|
|
||||||
|
|
||||||
import static java.util.Arrays.*;
|
import static java.util.Arrays.asList;
|
||||||
import static java.util.Collections.*;
|
import static java.util.Collections.singleton;
|
||||||
import static java.util.regex.Pattern.*;
|
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.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -70,7 +72,7 @@ public class SeasonEpisodeMatcher {
|
||||||
};
|
};
|
||||||
|
|
||||||
// match patterns like 01, 102, 1003 (enclosed in separators)
|
// 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
|
@Override
|
||||||
protected Collection<SxE> process(MatchResult match) {
|
protected Collection<SxE> process(MatchResult match) {
|
||||||
|
|
|
@ -1,20 +1,16 @@
|
||||||
|
|
||||||
package net.sourceforge.filebot.similarity;
|
package net.sourceforge.filebot.similarity;
|
||||||
|
|
||||||
|
import static java.util.Arrays.asList;
|
||||||
import static java.util.Arrays.*;
|
import static net.sourceforge.filebot.similarity.SeasonEpisodeMatcher.SxE.UNDEFINED;
|
||||||
import static net.sourceforge.filebot.similarity.SeasonEpisodeMatcher.SxE.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.*;
|
|
||||||
import net.sourceforge.filebot.similarity.SeasonEpisodeMatcher.SxE;
|
import net.sourceforge.filebot.similarity.SeasonEpisodeMatcher.SxE;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
public class SeasonEpisodeMatcherTest {
|
public class SeasonEpisodeMatcherTest {
|
||||||
|
|
||||||
private static SeasonEpisodeMatcher matcher = new SeasonEpisodeMatcher(null, false);
|
private static SeasonEpisodeMatcher matcher = new SeasonEpisodeMatcher(null, false);
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void patternPrecedence() {
|
public void patternPrecedence() {
|
||||||
// S01E01 pattern has highest precedence
|
// 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));
|
assertEquals(new SxE(1, 2), matcher.match("Test.42.s01e01.s01e02.300").get(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void pattern_1x01() {
|
public void pattern_1x01() {
|
||||||
assertEquals(new SxE(1, 1), matcher.match("1x01").get(0));
|
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));
|
assertEquals(new SxE(1, 3), matcher.match("Test_-_103_[1280x720]").get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void pattern_S01E01() {
|
public void pattern_S01E01() {
|
||||||
assertEquals(new SxE(1, 1), matcher.match("S01E01").get(0));
|
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));
|
assertEquals(new SxE(12, 345), matcher.match("Test - S12E345 - High Values").get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void pattern_101() {
|
public void pattern_101() {
|
||||||
assertEquals(new SxE(1, 1), matcher.match("Test.101").get(0));
|
assertEquals(new SxE(1, 1), matcher.match("Test.101").get(0));
|
||||||
|
@ -74,8 +67,10 @@ public class SeasonEpisodeMatcherTest {
|
||||||
|
|
||||||
// test ambiguous match processing
|
// test ambiguous match processing
|
||||||
assertEquals(asList(new SxE(1, 1), new SxE(UNDEFINED, 101)), matcher.match("Test.101"));
|
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
|
@Test
|
||||||
public void multiEpisodePatterns() {
|
public void multiEpisodePatterns() {
|
||||||
|
|
Loading…
Reference in New Issue