* allow more than 4 alias titles (e.g. in all languages) and see what happens

This commit is contained in:
Reinhard Pointner 2014-11-28 19:26:57 +00:00
parent 8659b40262
commit 3b3d4a40fd
2 changed files with 8 additions and 7 deletions

View File

@ -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()) }

View File

@ -209,17 +209,18 @@ public enum EpisodeMetrics implements SimilarityMetric {
protected Object[] fields(Object object) {
if (object instanceof Episode) {
Episode episode = (Episode) object;
LinkedHashSet<String> set = new LinkedHashSet<String>(4);
set.add(removeTrailingBrackets(episode.getSeriesName()));
set.add(removeTrailingBrackets(episode.getTitle()));
LinkedHashSet<String> keywords = new LinkedHashSet<String>(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<String> itr = set.iterator();
// create array with size 4
Object[] f = new Object[4];
Iterator<String> 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;
}