diff --git a/BuildData.groovy b/BuildData.groovy index f218815b..30b693e9 100644 --- a/BuildData.groovy +++ b/BuildData.groovy @@ -305,7 +305,7 @@ thetvdb_index = thetvdb_index.findResults{ [it[0] as Integer, it[1].replaceAll(/ thetvdb_index = thetvdb_index.sort{ a, b -> a[0] <=> b[0] } // join and sort -def thetvdb_txt = thetvdb_index.groupBy{ it[0] }.findResults{ k, v -> ([k.pad(6)] + v*.getAt(1).unique{ it.toLowerCase() }).take(4).join('\t') } +def thetvdb_txt = thetvdb_index.groupBy{ it[0] }.findResults{ k, v -> ([k.pad(6)] + v*.getAt(1).unique{ it.toLowerCase() }).join('\t') } // sanity check if (thetvdb_txt.size() < 4000) { die('TheTVDB index sanity failed: ' + thetvdb_txt.size()) } diff --git a/source/net/filebot/similarity/EpisodeMetrics.java b/source/net/filebot/similarity/EpisodeMetrics.java index 11dc66fd..f246b473 100644 --- a/source/net/filebot/similarity/EpisodeMetrics.java +++ b/source/net/filebot/similarity/EpisodeMetrics.java @@ -209,17 +209,18 @@ public enum EpisodeMetrics implements SimilarityMetric { protected Object[] fields(Object object) { if (object instanceof Episode) { Episode episode = (Episode) object; - LinkedHashSet set = new LinkedHashSet(4); - set.add(removeTrailingBrackets(episode.getSeriesName())); - set.add(removeTrailingBrackets(episode.getTitle())); + LinkedHashSet keywords = new LinkedHashSet(4); + keywords.add(removeTrailingBrackets(episode.getSeriesName())); + keywords.add(removeTrailingBrackets(episode.getTitle())); for (String it : episode.getSeries().getEffectiveNames()) { - set.add(removeTrailingBrackets(it)); + keywords.add(removeTrailingBrackets(it)); } - Iterator itr = set.iterator(); + // create array with size 4 Object[] f = new Object[4]; + Iterator keywordItr = keywords.iterator(); for (int i = 0; i < f.length; i++) { - f[i] = itr.hasNext() ? itr.next() : null; + f[i] = keywordItr.hasNext() ? keywordItr.next() : null; } return f; }