From 002740d5514d820a75565d6a4e91a2c76a21ca3b Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 19 Jul 2016 19:55:48 +0800 Subject: [PATCH] Discover recent/popular movies --- build-data/Discover.groovy | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 build-data/Discover.groovy diff --git a/build-data/Discover.groovy b/build-data/Discover.groovy new file mode 100755 index 00000000..f045fc07 --- /dev/null +++ b/build-data/Discover.groovy @@ -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)