1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-02 00:15:02 -04:00

Fix inconsistent SubstringFields metric behaviour

This commit is contained in:
Reinhard Pointner 2016-08-23 00:51:47 +08:00
parent 4333193b98
commit bdc81b3501

View File

@ -208,10 +208,13 @@ public enum EpisodeMetrics implements SimilarityMetric {
return stream(objects).map(EpisodeMetrics::normalizeObject).toArray(String[]::new);
}
protected static final int MAX_FIELDS = 5;
protected Object[] fields(Object object) {
if (object instanceof Episode) {
Episode e = (Episode) object;
return StreamEx.of(e.getSeriesName(), e.getTitle()).append(e.getSeriesNames()).filter(Objects::nonNull).map(Normalization::removeTrailingBrackets).distinct().limit(5).toArray();
Object[] names = StreamEx.of(e.getSeriesName(), e.getTitle()).append(e.getSeriesNames()).filter(Objects::nonNull).map(Normalization::removeTrailingBrackets).distinct().limit(MAX_FIELDS).toArray();
return copyOf(names, MAX_FIELDS);
}
if (object instanceof File) {