Support for custom build data

This commit is contained in:
Reinhard Pointner 2018-03-12 16:46:14 +07:00
parent e21b673de9
commit 55c3b2c157
1 changed files with 7 additions and 7 deletions

View File

@ -66,7 +66,7 @@ def pack(file, lines) {
lines.each{ writer.append(it).append('\n') } lines.each{ writer.append(it).append('\n') }
} }
} }
new File(file.parentFile, file.name + '.xz').withOutputStream{ out -> file.parentFile.resolve(file.name + '.xz').withOutputStream{ out ->
new XZOutputStream(out, new LZMA2Options(LZMA2Options.PRESET_DEFAULT)).withWriter('UTF-8'){ writer -> new XZOutputStream(out, new LZMA2Options(LZMA2Options.PRESET_DEFAULT)).withWriter('UTF-8'){ writer ->
lines.each{ writer.append(it).append('\n') } lines.each{ writer.append(it).append('\n') }
} }
@ -129,10 +129,10 @@ if (_args.mode == /no-index/) {
def movies_index = [:] def movies_index = [:]
['ancient-movies.txt', 'recent-movies.txt'].each{ ['ancient-movies.txt', 'recent-movies.txt'].each{
movies_index << csv(it as File, '\t', 1, [1..-1]) movies_index << csv(dir_data.resolve(it), '\t', 1, [1..-1])
} }
def tmdb_txt = 'tmdb.txt' as File def tmdb_txt = dir_data.resolve('tmdb.txt')
def tmdb_index = csv(tmdb_txt, '\t', 1, [0..-1]) def tmdb_index = csv(tmdb_txt, '\t', 1, [0..-1])
def tmdb = [] def tmdb = []
@ -184,7 +184,7 @@ pack(moviedb_out, movies*.join('\t'))
// ------------------------------ BUILD SERIES INDEX ------------------------------ // // ------------------------------ BUILD SERIES INDEX ------------------------------ //
def tvdb_txt = 'tvdb.txt' as File def tvdb_txt = dir_data.resolve('tvdb.txt')
def tvdb = [:] def tvdb = [:]
if (tvdb_txt.exists()) { if (tvdb_txt.exists()) {
@ -196,7 +196,7 @@ if (tvdb_txt.exists()) {
} }
def tvdb_updates = [:] as TreeMap def tvdb_updates = [:] as TreeMap
('updates_all.xml' as File).eachLine('UTF-8'){ dir_data.resolve('updates_all.xml').eachLine('UTF-8'){
def m = (it =~ '<Series><id>(\\d+)</id><time>(\\d+)</time></Series>') def m = (it =~ '<Series><id>(\\d+)</id><time>(\\d+)</time></Series>')
while(m.find()) { while(m.find()) {
def id = m.group(1) as Integer def id = m.group(1) as Integer
@ -324,7 +324,7 @@ pack(thetvdb_out, thetvdb_txt)
def osdb = [] def osdb = []
('osdb.txt' as File).eachLine('UTF-8'){ dir_data.resolve('osdb.txt').eachLine('UTF-8'){
def fields = it.split(/\t/)*.trim() def fields = it.split(/\t/)*.trim()
// 0 IDMovie, 1 IDMovieImdb, 2 MovieName, 3 MovieYear, 4 MovieKind, 5 MoviePriority // 0 IDMovie, 1 IDMovieImdb, 2 MovieName, 3 MovieYear, 4 MovieKind, 5 MoviePriority
@ -375,7 +375,7 @@ def anidb = new AnidbClient('filebot', 6).getAnimeTitles() as List
def animeExcludes = [] as Set def animeExcludes = [] as Set
// exclude anime movies from anime index // exclude anime movies from anime index
('anime-list.xml' as File).eachLine('UTF-8') { dir_data.resolve('anime-list.xml').eachLine('UTF-8') {
if (it =~ /tvdbid="movie"/ || it =~ /imdbid="ttd\+"/) { if (it =~ /tvdbid="movie"/ || it =~ /imdbid="ttd\+"/) {
animeExcludes << it.match(/anidbid="(\d+)"/).toInteger() animeExcludes << it.match(/anidbid="(\d+)"/).toInteger()
} }