1
0
mirror of https://github.com/mitb-archive/filebot synced 2025-01-10 21:38:04 -05:00

Improved matching behavior for movie years off by one

This commit is contained in:
Reinhard Pointner 2017-10-21 23:57:33 +01:00
parent 2ed3f0995d
commit b99500b405

View File

@ -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