* improved multi-episode pattern matching

This commit is contained in:
Reinhard Pointner 2012-06-25 17:30:21 +00:00
parent 2e0c89d140
commit 90705fd66f
2 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,7 @@ public class SeasonEpisodeMatcher {
patterns[0] = 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})");
// match patterns like S01E01, s01e02, ... [s01]_[e02], s01.e02, s01e02a, s2010e01 ... s01e01-02-03-04, [s01]_[e01-02-03-04] ...
patterns[1] = new SeasonEpisodePattern(null, "(?<!\\p{Alnum})[Ss](\\d{1,2}|\\d{4})[^\\p{Alnum}]{0,3}[Ee]((\\d{1,2}\\D?)+)(?!\\p{Digit})") {
patterns[1] = new SeasonEpisodePattern(null, "(?<!\\p{Alnum})[Ss](\\d{1,2}|\\d{4})[^\\p{Alnum}]{0,3}[Ee](((?<=[^._ ])\\d{1,2}(\\D|$))+)") {
@Override
protected Collection<SxE> process(MatchResult match) {
@ -43,7 +43,7 @@ public class SeasonEpisodeMatcher {
};
// match patterns like 1x01, 1.02, ..., 1x01a, 10x01, 10.02, ... 1x01-02-03-04, 1x01x02x03x04 ...
patterns[2] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum}|\\d{4}[.])(\\d{1,2})[x.]((\\d{2,3}\\D?)+)(?!\\p{Digit})") {
patterns[2] = new SeasonEpisodePattern(sanity, "(?<!\\p{Alnum}|\\d{4}[.])(\\d{1,2})[x.](((?<=[^._ ])\\d{2,3}(\\D|$))+)") {
@Override
protected Collection<SxE> process(MatchResult match) {

View File

@ -145,7 +145,7 @@ public class EpisodeFormat extends Format {
if (!it.getSeason().equals(ps)) {
sb.append(String.format("S%02d", it.getSeason())).append(String.format("E%02d", it.getEpisode()));
} else {
sb.append('-').append(String.format("E%02d", it.getEpisode()));
sb.append(String.format("E%02d", it.getEpisode()));
}
ps = it.getSeason();
}