* enhanced support for documentary numbering, e.g. 1of6

@see http://www.filebot.net/forums/viewtopic.php?f=6&t=1398
This commit is contained in:
Reinhard Pointner 2014-03-08 08:25:04 +00:00
parent 088e5f4816
commit d9dde4fdf9
3 changed files with 13 additions and 2 deletions

View File

@ -26,7 +26,7 @@ public class SeasonEpisodeMatcher {
public SeasonEpisodeMatcher(SeasonEpisodeFilter sanity, boolean strict) {
// define variables
SeasonEpisodePattern Season_00_Episode_00, S00E00, SxE, Dot101, EP0, Num101_TOKEN, Num101_SUBSTRING;
SeasonEpisodePattern Season_00_Episode_00, S00E00, SxE, Dot101, EP0, Num101_TOKEN, E1of2, Num101_SUBSTRING;
// match patterns like Season 01 Episode 02, ...
Season_00_Episode_00 = new SeasonEpisodePattern(null, "(?<!\\p{Alnum})(?i:season|series)[^\\p{Alnum}]{0,3}(\\d{1,4})[^\\p{Alnum}]{0,3}(?i:episode)[^\\p{Alnum}]{0,3}(\\d{1,4})[^\\p{Alnum}]{0,3}(?!\\p{Digit})");
@ -107,6 +107,15 @@ public class SeasonEpisodeMatcher {
}
};
E1of2 = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum})(\\d{1,2})[^._ ]?(?i:of)[^._ ]?(\\d{1,2})(?!\\p{Digit})") {
@Override
protected Collection<SxE> process(MatchResult match) {
// regex doesn't match season
return singleton(new SxE(null, match.group(1)));
}
};
// (last-resort) match patterns like 101, 102 (and greedily just grab the first)
Num101_SUBSTRING = new SeasonEpisodePattern(STRICT_SANITY, "([1-9]{1})(\\d{2}).+") {
@ -120,7 +129,7 @@ public class SeasonEpisodeMatcher {
if (strict) {
patterns = new SeasonEpisodeParser[] { Season_00_Episode_00, S00E00, SxE, Dot101 };
} else {
patterns = new SeasonEpisodeParser[] { Season_00_Episode_00, S00E00, SxE, Dot101, new SeasonEpisodeUnion(EP0, Num101_TOKEN), Num101_SUBSTRING };
patterns = new SeasonEpisodeParser[] { Season_00_Episode_00, S00E00, SxE, Dot101, new SeasonEpisodeUnion(EP0, Num101_TOKEN, E1of2), Num101_SUBSTRING };
}
// season folder pattern for complementing partial sxe info from filename

View File

@ -24,6 +24,7 @@ public class SeasonEpisodeMatcherTest {
assertEquals(new SxE(null, 18), matcher.match("World.Series.Of.Poker.2013.Main.Event.Part18.480p.HDTV.x264-mSD").get(0));
assertEquals(asList(new SxE(null, 01), new SxE(1, 01), new SxE(null, 101)), matcher.match("alias.101.Part1"));
assertEquals(asList(new SxE(null, 01)), matcher.match("Documentaries.1of6"));
// multiple values
assertEquals(new SxE(1, 2), matcher.match("Test.42.s01e01.s01e02.300").get(1));

View File

@ -39,6 +39,7 @@
^deluge$
^disk[0-9]$
^Documentary$
^Documentaries$
^Done$
^Download$
^Downloading$