exclude anime movies from anime index

This commit is contained in:
Reinhard Pointner 2016-02-05 16:31:53 +00:00
parent 9ff40f8a23
commit be99a1f122
1 changed files with 14 additions and 3 deletions

View File

@ -355,19 +355,30 @@ pack(osdb_out, osdb*.join('\t'))
// BUILD anidb index // BUILD anidb index
def anidb = new AnidbClient('filebot', 5).getAnimeTitles() def anidb = new AnidbClient('filebot', 6).getAnimeTitles()
def animeExcludes = new HashSet()
// exclude anime movies from anime index
new File('anime-list.xml').eachLine('UTF-8') {
if (it =~ /tvdbid="movie"/) {
animeExcludes << it.match(/anidbid="(\d+)"/).toInteger()
}
}
def anidb_index = anidb.findResults{ def anidb_index = anidb.findResults{
if (animeExcludes.contains(it.animeId))
return null
def names = it.effectiveNames*.replaceAll(/\s+/, ' ')*.trim()*.replaceAll(/['`´ʻ]+/, /'/) def names = it.effectiveNames*.replaceAll(/\s+/, ' ')*.trim()*.replaceAll(/['`´ʻ]+/, /'/)
names = getNamePermutations(names) names = getNamePermutations(names)
names = names.findAll{ stripReleaseInfo(it)?.length() > 0 } names = names.findAll{ stripReleaseInfo(it)?.length() > 0 }
return names.empty ? null : [it.getAnimeId().pad(5)] + names.take(4) return names.empty ? null : [it.animeId.pad(5)] + names.take(4)
} }
// join and sort // join and sort
def anidb_txt = anidb_index.findResults{ row -> row.join('\t') }.sort().unique() def anidb_txt = anidb_index.findResults{ row -> row.join('\t') }.sort().unique()
// sanity check // sanity check
if (anidb_txt.size() < 8000) { die('AniDB index sanity failed:' + anidb_txt.size()) } if (anidb_txt.size() < 8000 || animeExcludes.size() < 500) { die('AniDB index sanity failed:' + anidb_txt.size()) }
pack(anidb_out, anidb_txt) pack(anidb_out, anidb_txt)