SxE sequences must increase in linear order (e.g. multi episode 04-05 is allowed but Episode 05-04 will not be interpreted as multi episode)
@see https://www.filebot.net/forums/viewtopic.php?f=8&t=4507&p=25067#p25067
This commit is contained in:
parent
189a0fb52e
commit
77512d0e4f
|
@ -219,7 +219,7 @@ public class SeasonEpisodeMatcher {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static class SxE {
|
||||
public static class SxE implements Comparable<SxE> {
|
||||
|
||||
public static final int UNDEFINED = -1;
|
||||
|
||||
|
@ -254,6 +254,11 @@ public class SeasonEpisodeMatcher {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(SxE other) {
|
||||
return season < other.season ? -1 : season != other.season ? 1 : episode < other.episode ? -1 : episode != other.episode ? 1 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(season, episode);
|
||||
|
@ -324,7 +329,9 @@ public class SeasonEpisodeMatcher {
|
|||
while (matcher.find()) {
|
||||
for (SxE value : process.apply(matcher)) {
|
||||
if (sanity == null || sanity.filter(value)) {
|
||||
matches.add(value);
|
||||
if (matches.isEmpty() || matches.get(matches.size() - 1).compareTo(value) < 0) {
|
||||
matches.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,6 +109,9 @@ public class SeasonEpisodeMatcherTest {
|
|||
assertEquals(new SxE(1, 4), matcher.match("1x01.1x02.1x03.1x04").get(3));
|
||||
|
||||
assertEquals(new SxE(null, 4), matcher.match("E1E2E3E4").get(3));
|
||||
|
||||
assertEquals("[05]", matcher.match("05.Chapter.04+1").toString());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue