Improved matching behavior for movie years off by one
This commit is contained in:
parent
2ed3f0995d
commit
b99500b405
|
@ -42,6 +42,7 @@ import java.util.function.Supplier;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
import net.filebot.ApplicationFolder;
|
import net.filebot.ApplicationFolder;
|
||||||
import net.filebot.Language;
|
import net.filebot.Language;
|
||||||
|
@ -710,12 +711,7 @@ public class MediaDetection {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String normalize(Object object) {
|
protected String normalize(Object object) {
|
||||||
Matcher ym = year.matcher(object.toString());
|
return streamMatches(object.toString(), year).mapToInt(Integer::parseInt).flatMap(i -> IntStream.of(i, i + 1)).mapToObj(Objects::toString).collect(joining(" "));
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
while (ym.find()) {
|
|
||||||
sb.append(ym.group()).append(' ');
|
|
||||||
}
|
|
||||||
return sb.toString().trim();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue