mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-02 08:25:02 -04:00
Discover recent/popular movies
This commit is contained in:
parent
be9d70150d
commit
2c1757faad
@ -9,22 +9,30 @@ if (recentMoviesFile.exists()) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def toDate = LocalDate.now()
|
def updateMovieIndex = { m ->
|
||||||
def fromDate = LocalDate.now().minus(Period.ofDays(30))
|
|
||||||
def locale = Locale.ENGLISH
|
|
||||||
|
|
||||||
TheMovieDB.discover(fromDate, toDate, locale).each{ m ->
|
|
||||||
if (!recentMoviesIndex.containsKey(m.tmdbId)) {
|
if (!recentMoviesIndex.containsKey(m.tmdbId)) {
|
||||||
def i = TheMovieDB.getMovieInfo(m, locale, false)
|
def i = TheMovieDB.getMovieInfo(m, Locale.ENGLISH, false)
|
||||||
|
|
||||||
if (i.imdbId == null)
|
if (i.imdbId == null)
|
||||||
return
|
return
|
||||||
|
|
||||||
def row = [i.id.pad(6), i.imdbId.pad(7), i.released.year as String, i.name]
|
def row = [i.id.pad(6), i.imdbId.pad(7), i.released.year as String, i.name]
|
||||||
println row
|
log.finest "$row"
|
||||||
|
|
||||||
recentMoviesIndex.put(row[0] as int, row)
|
recentMoviesIndex.put(row[0] as int, row)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def to = LocalDate.now()
|
||||||
|
def from = to.minus(Period.ofDays(30))
|
||||||
|
def year = from.year
|
||||||
|
|
||||||
|
log.fine "Discover Recent [$from to $to]"
|
||||||
|
TheMovieDB.discover(from, to, Locale.ENGLISH).each{ updateMovieIndex(it) }
|
||||||
|
|
||||||
|
log.fine "Discover Best of Year [$year]"
|
||||||
|
TheMovieDB.discover(year, Locale.ENGLISH).each{ updateMovieIndex(it) }
|
||||||
|
|
||||||
|
|
||||||
recentMoviesIndex.values()*.join('\t').join('\n').saveAs(recentMoviesFile)
|
recentMoviesIndex.values()*.join('\t').join('\n').saveAs(recentMoviesFile)
|
||||||
|
Loading…
Reference in New Issue
Block a user