Discover recent/popular movies

This commit is contained in:
Reinhard Pointner 2016-07-19 19:55:48 +08:00
parent 0312dcaf83
commit 002740d551
1 changed files with 15 additions and 0 deletions

15
build-data/Discover.groovy Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env filebot -script
def recentMoviesFile = new File('recent-movies.txt')
def recentMoviesIndex = (recentMoviesFile.exists() ? recentMoviesFile.readLines('UTF-8') : []) as TreeSet
def toDate = LocalDate.now()
def fromDate = LocalDate.now().minus(Period.ofDays(30))
TheMovieDB.discover(fromDate, toDate, Locale.ENGLISH).each{ m ->
if (recentMoviesIndex.add([m.tmdbId.pad(6), m.year, m.name].join('\t'))) {
println m
}
}
recentMoviesIndex.join('\n').saveAs(recentMoviesFile)