From 42621956b3c3cd62a27fd90a0167dffc71f10722 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 31 Dec 2012 10:06:08 +0000 Subject: [PATCH] * use movie auto-detection in movie artwork scripts --- website/scripts/artwork.tmdb.groovy | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/website/scripts/artwork.tmdb.groovy b/website/scripts/artwork.tmdb.groovy index b3398c61..3ef17d43 100644 --- a/website/scripts/artwork.tmdb.groovy +++ b/website/scripts/artwork.tmdb.groovy @@ -17,16 +17,24 @@ args.eachMediaFolder{ dir -> def videos = dir.listFiles{ it.isVideo() } - def query = _args.query ?: dir.name - def options = TheMovieDB.searchMovie(query, _args.locale) + def query = _args.query + def options = [] + + if (query) { + // manual search + options = TheMovieDB.searchMovie(query, _args.locale) + // sort by relevance + options = options.sortBySimilarity(query, { it.name }) + } else { + // auto-detection + options = net.sourceforge.filebot.media.MediaDetection.detectMovie(videos[0], null, TheMovieDB, _args.locale, true) + } + if (options.isEmpty()) { println "Movie not found: $query" return } - // sort by relevance - options = options.sortBySimilarity(query, { it.name }) - // auto-select movie def movie = options[0]