htpc - fetchAllMovieArtwork BUG

All your suggestions, requests and ideas for future development
Post Reply
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

htpc - fetchAllMovieArtwork BUG

Post by kim »

the "null" = get ALL artwork even if not e.g 'de', 'en'

Code: Select all

def selection = [locale.language, 'en', null].findResults{ lang -> artwork.findAll{ it.matches(lang) } }.flatten().unique()
my fix (I'm not sure if 'xx' is used in the api anymore?):

Code: Select all

def selection = ['null', 'xx', locale.language, 'en'].findResults{ lang -> artwork.findAll{ it.language.toString().matches(lang) } }.flatten().unique()
btw: I think 'backdrops', should always be 'null'/ 'xx' first = no language

https://github.com/filebot/scripts/blob ... roovy#L217
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: htpc - fetchAllMovieArtwork BUG

Post by rednoah »

Can you give me a few examples how it makes a difference? If I change the behaviour, I'd like to be able to point to a couple of A/B tests and see why A is preferable to B.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: htpc - fetchAllMovieArtwork BUG

Post by kim »

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()
=
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.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: htpc - fetchAllMovieArtwork BUG

Post by kim »

did you test the "problem" ?
how do you think it should be ?
Post Reply