1. take any movie that has a non "English" or "No language" (and your locale.language is not e.g. 'es')
e.g.
https://www.themoviedb.org/movie/298250
Code: Select all
{
def Locale locale = Locale.US
def artwork = net.filebot.WebServices.TheMovieDB.getArtwork(298250, 'backdrops', locale)
def selection = ['null', 'xx', locale.language, 'en'].findResults{ lang -> artwork.findAll{ it.language.toString().matches(lang) } }.flatten().unique()
println selection.url
println selection.language
}
=
Code: Select all
def selection = [locale.language, 'en', null].findResults{ lang -> artwork.findAll{ it.matches(lang) } }.flatten().unique()
=
[
https://image.tmdb.org/t/p/original/ytK ... rtTt6R.jpg,
https://image.tmdb.org/t/p/original/25o ... Ed0xxg.jpg,
https://image.tmdb.org/t/p/original/sbw ... GOzno3.jpg,
https://image.tmdb.org/t/p/original/8t2 ... zuEXUd.jpg,
https://image.tmdb.org/t/p/original/hUy ... 5Qnk8t.jpg,
https://image.tmdb.org/t/p/original/qH9 ... shuQCW.jpg]
[null, null, xx, null, es, null]
the problem here is the 'es' because of "null" is = ANY and not to "null" aka "No language"
this does the same thing
[locale.language, 'en', null] = [null]
but only when getting ALL pics, if getting 1 pic then
[null]
is better (#1 voted pic)
if
[locale.language, 'en', null]
then it gets the #1 locale.language or 'en'
2. "btw: I think 'backdrops', should always be 'null'/ 'xx' first = no language"
the order in the "[locale.language, 'en', null]" makes no difference (when it works proper) because it downloads all pics, but it does make a big dif. here:
https://github.com/filebot/scripts/blob ... roovy#L205
that is why I did this (split up posters/backdrops):
Code: Select all
def fetchMovieArtwork(outputFile, movieInfo, category, override, locale){
// select and fetch artwork
if (outputFile.exists() && !override){
log.finest "FROM custom htpc fetchMovieArtwork - Artwork already exists: [$outputFile]"
return outputFile
}
def artwork = TheMovieDB.getArtwork(movieInfo.id, category, locale)
if (category == 'posters'){
def selection = [locale.language, 'en', 'null', 'xx'].findResult{ lang -> artwork.find{ it.language.toString().matches(lang) } }
if (selection == null){
log.finest "FROM custom htpc fetchMovieArtwork posters - Artwork not found: [$outputFile]"
return null
}
log.finest "FROM custom htpc fetchMovieArtwork posters - Downloading poster $selection => [$outputFile]"
return selection.url.saveAs(outputFile)
}
if (category == 'backdrops'){
def selection = ['null', 'xx', locale.language, 'en'].findResult{ lang -> artwork.find{ it.language.toString().matches(lang) } }
if (selection == null){
log.finest "FROM custom htpc fetchMovieArtwork backdrops - Artwork not found: [$outputFile]"
return null
}
log.finest "FROM custom htpc fetchMovieArtwork backdrops - Downloading fanart $selection => [$outputFile]"
return selection.url.saveAs(outputFile)
}
}
"No language" 'backdrops' are 9 times out of 10 way better quality + ALL the language ones is only there because it has the locale movie title (the poster already has this) or some other (ugly) locale text.