Discover recent/popular movies
This commit is contained in:
parent
002740d551
commit
d79e4bba1d
@ -184,7 +184,7 @@ omdb.each{ m ->
|
|||||||
}
|
}
|
||||||
tmdb*.join('\t').join('\n').saveAs(tmdb_txt)
|
tmdb*.join('\t').join('\n').saveAs(tmdb_txt)
|
||||||
|
|
||||||
movies = tmdb.findResults{
|
def movies = tmdb.findResults{
|
||||||
def ity = it[1..3] // imdb id, tmdb id, year
|
def ity = it[1..3] // imdb id, tmdb id, year
|
||||||
def names = getNamePermutations(it[4..-1]).findAll{ isValidMovieName(it) }
|
def names = getNamePermutations(it[4..-1]).findAll{ isValidMovieName(it) }
|
||||||
if (ity[0].toInteger() > 0 && ity[1].toInteger() > 0 && names.size() > 0)
|
if (ity[0].toInteger() > 0 && ity[1].toInteger() > 0 && names.size() > 0)
|
||||||
|
@ -1,15 +1,30 @@
|
|||||||
#!/usr/bin/env filebot -script
|
#!/usr/bin/env filebot -script
|
||||||
|
|
||||||
def recentMoviesFile = new File('recent-movies.txt')
|
def recentMoviesFile = new File('recent-movies.txt')
|
||||||
def recentMoviesIndex = (recentMoviesFile.exists() ? recentMoviesFile.readLines('UTF-8') : []) as TreeSet
|
def recentMoviesIndex = new TreeMap()
|
||||||
|
|
||||||
def toDate = LocalDate.now()
|
if (recentMoviesFile.exists()) {
|
||||||
def fromDate = LocalDate.now().minus(Period.ofDays(30))
|
recentMoviesFile.splitEachLine('\t', 'UTF-8') { line ->
|
||||||
|
recentMoviesIndex.put(line[0] as int, line)
|
||||||
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)
|
def toDate = LocalDate.now()
|
||||||
|
def fromDate = LocalDate.now().minus(Period.ofDays(30))
|
||||||
|
def locale = Locale.ENGLISH
|
||||||
|
|
||||||
|
TheMovieDB.discover(fromDate, toDate, locale).each{ m ->
|
||||||
|
if (!recentMoviesIndex.containsKey(m.tmdbId)) {
|
||||||
|
def i = TheMovieDB.getMovieInfo(m, locale, false)
|
||||||
|
|
||||||
|
if (i.imdbId == null)
|
||||||
|
return
|
||||||
|
|
||||||
|
def row = [i.id.pad(6), i.imdbId.pad(7), i.released.year as String, i.name]
|
||||||
|
println row
|
||||||
|
|
||||||
|
recentMoviesIndex.put(row[0] as int, row)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
recentMoviesIndex.values()*.join('\t').join('\n').saveAs(recentMoviesFile)
|
||||||
|
Loading…
Reference in New Issue
Block a user