* fix multi-episode detection for high SxE numbers (e.g. S01E99-E100)
This commit is contained in:
parent
4de4fc65f7
commit
46ae76d89a
|
@ -102,12 +102,20 @@ public class EpisodeMatcher extends Matcher<File, Object> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<Integer> normalizeIdentifierSet(Set<SxE> numbers) {
|
private Set<Integer> normalizeIdentifierSet(Set<SxE> numbers) {
|
||||||
|
// check if any episode exceeds the episodes per season limit
|
||||||
|
int limit = 100;
|
||||||
|
for (SxE it : numbers) {
|
||||||
|
while (it.season > 0 && it.episode >= limit) {
|
||||||
|
limit *= 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// SxE 1x01 => 101
|
// SxE 1x01 => 101
|
||||||
// Absolute 101 => 101
|
// Absolute 101 => 101
|
||||||
Set<Integer> identifier = new HashSet<Integer>(numbers.size());
|
Set<Integer> identifier = new HashSet<Integer>(numbers.size());
|
||||||
for (SxE it : numbers) {
|
for (SxE it : numbers) {
|
||||||
if (it.season > 0 && it.episode > 0 && it.episode < 100) {
|
if (it.season > 0 && it.episode > 0 && it.episode < limit) {
|
||||||
identifier.add(it.season * 100 + it.episode);
|
identifier.add(it.season * limit + it.episode);
|
||||||
} else if (it.season <= 0 && it.episode > 0) {
|
} else if (it.season <= 0 && it.episode > 0) {
|
||||||
identifier.add(it.episode);
|
identifier.add(it.episode);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue