From be99a1f122a96e688c207fbb412b64b408b3d704 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 5 Feb 2016 16:31:53 +0000 Subject: [PATCH] exclude anime movies from anime index --- build-data/BuildData.groovy | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/build-data/BuildData.groovy b/build-data/BuildData.groovy index b4900e84..57af6552 100755 --- a/build-data/BuildData.groovy +++ b/build-data/BuildData.groovy @@ -355,19 +355,30 @@ pack(osdb_out, osdb*.join('\t')) // 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{ + if (animeExcludes.contains(it.animeId)) + return null + def names = it.effectiveNames*.replaceAll(/\s+/, ' ')*.trim()*.replaceAll(/['`´‘’ʻ]+/, /'/) names = getNamePermutations(names) 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 def anidb_txt = anidb_index.findResults{ row -> row.join('\t') }.sort().unique() // 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)