How to get the correct poster from TMDB?
-
- Posts: 6
- Joined: 21 Dec 2016, 00:25
How to get the correct poster from TMDB?
Hi, I'm using the last version with the UI and the post processing fetch artwork and cover images.
It works great but the posters that I'm getting in several movies are not the primary ones.
What I would like is that the posters that I get are the same of the TMDB website.
Also the fanart seems to take priority in size instead of order. Commonly the first one is the nicer one.
Is that posible?
Thanks
It works great but the posters that I'm getting in several movies are not the primary ones.
What I would like is that the posters that I get are the same of the TMDB website.
Also the fanart seems to take priority in size instead of order. Commonly the first one is the nicer one.
Is that posible?
Thanks
Re: How to get the correct poster from TMDB?
movie ?
result ?
result YOU want ?
language ?
we are not mind readers
result ?
result YOU want ?
language ?
we are not mind readers

Re: How to get the correct poster from TMDB?
@rednoah
just tried the GUI make movie.nfo and I think there is multiple errors:
sample:
correct =
correct =
switched
just tried the GUI make movie.nfo and I think there is multiple errors:
sample:
Code: Select all
<uniqueid default="true" tmdb="1234"/>
Code: Select all
<uniqueid type='tmdb'>1234</uniqueid>
Code: Select all
<rating default="true" max="10" name="themoviedb">
Code: Select all
<rating name='tmdb' max='10' default='true'>
Code: Select all
<imdb id="tt12345678">https://www.themoviedb.org/movie/1234</imdb>
<tmdb id="1234">https://www.imdb.com/title/tt12345678</tmdb>
Re: How to get the correct poster from TMDB?
FileBot r8139 implements the suggested changes.
Re: How to get the correct poster from TMDB?
just to be clear
correct =kim wrote: ↑12 Nov 2020, 00:24 @rednoah
switchedCode: Select all
<imdb id="tt12345678">https://www.themoviedb.org/movie/1234</imdb> <tmdb id="1234">https://www.imdb.com/title/tt12345678</tmdb>
Code: Select all
<tmdb id="1234">https://www.themoviedb.org/movie/1234</tmdb>
<imdb id="tt12345678">https://www.imdb.com/title/tt12345678</imdb>
Re: How to get the correct poster from TMDB?
Yep. Looks like a copy & paste error nobody noticed. Fixed that too.
Re: How to get the correct poster from TMDB?
is it possible (or can you make it so) to make the nfo's with custom scripts (like i do with amc/htpc.groovy) ?
Re: How to get the correct poster from TMDB?
Not currently possible and not planned as far as the GUI is concerned.
-
- Posts: 6
- Joined: 21 Dec 2016, 00:25
Re: How to get the correct poster from TMDB?
Sorry didn't have notifications on.
For example, this movie: https://www.themoviedb.org/movie/369972 ... es/posters
FileBot downloads the second picture, and I want the first one, the primary in this case.
Language is English.
Re: How to get the correct poster from TMDB?
TheMovieDB doesn't strictly make that possible, since there's no "primary" field:
https://pastebin.com/3M6yxEJx
We could just take the first poster, which seems to be the primary one in this case. I'm not sure if the API guarantees any kind of order though. Also, we'd lose support for getting the language-specific poster because currently FileBot will pick the poster that matches your preferred language whichever has the highest rating.
https://pastebin.com/3M6yxEJx

-
- Posts: 6
- Joined: 21 Dec 2016, 00:25
Re: How to get the correct poster from TMDB?
For what I could test, the first one on the web (backdrop or poster), filtered by language (English in this case), seems to be the primary one. If the order on the API is the same, you could filter by language and maintain the original order? Or just take the first one in the list with that language.rednoah wrote: ↑12 Nov 2020, 14:46 TheMovieDB doesn't strictly make that possible, since there's no "primary" field:
https://pastebin.com/3M6yxEJx
We could just take the first poster, which seems to be the primary one in this case. I'm not sure if the API guarantees any kind of order though. Also, we'd lose support for getting the language-specific poster because currently FileBot will pick the poster that matches your preferred language whichever has the highest rating.
The fanart (backdrop) in this case also retrieves the second one: https://www.themoviedb.org/movie/1726-i ... anguage=en
Re: How to get the correct poster from TMDB?
the "primary" is = a moderator select it manually = not most or best votes
you can get in
btw: Backdrops "No Language" is best NOT language
you can get in
Code: Select all
poster_path "/i91mfvFcPPlaegcbOyjGgiWfZzh.jpg"
Code: Select all
https://api.themoviedb.org/3/movie/369972?language=en-US&api_key=
btw: Backdrops "No Language" is best NOT language
Re: How to get the correct poster from TMDB?
backdrops are already not sorted in website order:SebasNights wrote: ↑12 Nov 2020, 15:06 For what I could test, the first one on the web (backdrop or poster), filtered by language (English in this case), seems to be the primary one. If the order on the API is the same, you could filter by language and maintain the original order? Or just take the first one in the list with that language.
https://pastebin.com/JH8v6P5S

I've updated --apply cover to use that, so --apply cover and --apply artwork may now possibly end up fetching different images.kim wrote: ↑12 Nov 2020, 15:48 the "primary" is = a moderator select it manually = not most or best votes
you can get inCode: Select all
poster_path "/i91mfvFcPPlaegcbOyjGgiWfZzh.jpg"
Re: How to get the correct poster from TMDB?
maybe better to:
poster:
filter by "language"
check if primary is diff. then first of filtered "language"
yes = select primary
no = select first from filtered "language"
then it will be like on the website = easy to use
backdrops:
"language" is bad (use only as backup) "No Language" (null or xx) is best
select first
btw:
Primary Poster
New PRIMARY Designation for Posters
poster:
filter by "language"
check if primary is diff. then first of filtered "language"
yes = select primary
no = select first from filtered "language"
then it will be like on the website = easy to use

backdrops:
"language" is bad (use only as backup) "No Language" (null or xx) is best
select first
btw:
Primary Poster
New PRIMARY Designation for Posters
Re: How to get the correct poster from TMDB?
Does the amc / htpc script have any specific selection logic for backdrops?
Does --apply artwork select different artwork compared to the scripts?
Because the htpc script code hasn't been touched in years, so I'm weary of making changes that might break things for the possibly silent majority (?) that are happy with the current behavior.
Does --apply artwork select different artwork compared to the scripts?
Because the htpc script code hasn't been touched in years, so I'm weary of making changes that might break things for the possibly silent majority (?) that are happy with the current behavior.
Re: How to get the correct poster from TMDB?
Code: Select all
def selection = [locale.language, 'en', null].findResult{ lang -> artwork.find{ it.matches(lang) } }
I think the null is not working my fix is
Code: Select all
it.language.toString().replace(/null/,'xx')
Code: Select all
def artFilter = { it.findResult{ lang -> artwork.find{ it.language == lang } }?.language }
if (category == 'posters') {
preferredLang = artFilter( [locale.language, 'en', movieInfo.originalLanguage , 'xx'] )
}
if (category == 'backdrops') {
preferredLang = artFilter( ['xx', locale.language, 'en'] )
}
can I see the source code ?Does --apply artwork select different artwork compared to the scripts?
you may need to change in fetchAllMovieArtwork also
Code: Select all
def selection = ['null', 'xx', locale.language, 'en', movieInfo.originalLanguage].findResults{ lang -> artwork.findAll{ it.language.toString().matches(lang) } }.flatten().unique()
Re: How to get the correct poster from TMDB?
Can you give me a test case for a movie where we prefer the xx backdrop?
The Java code is completely different, and unfortunately not a one liner, but it boils down to sorting all the artwork and then picking the first one according to the relevanceOrder() comparator:
There's no support for order of preferred locale. If we were to add that, then we'd have to make sure that we prefer xx/null only for backdrops, but not for everything else. Because lots of non-
English speaking users like how things work right now.
Note that Artwork.matches(null) (i.e. accept anything) always returns true. You'd have to explicitly check artwork.language == null to find artwork where the language is null specifically.
The Java code is completely different, and unfortunately not a one liner, but it boils down to sorting all the artwork and then picking the first one according to the relevanceOrder() comparator:
Code: Select all
public static Comparator<Artwork> ratingOrder() {
return Comparator.comparing(Artwork::getRating, reverseOrder());
}
public static Comparator<Artwork> languageOrder(Locale locale) {
return Comparator.comparingInt(a -> a.language == null ? 1 : locale.getLanguage().equals(a.language) ? 0 : 2);
}
public static Comparator<Artwork> relevanceOrder(Locale locale) {
Comparator<Artwork> c = languageOrder(locale);
if (!locale.getLanguage().equals(Locale.ENGLISH.getLanguage())) {
c = c.thenComparing(languageOrder(Locale.ENGLISH));
}
return c.thenComparing(ratingOrder());
}

English speaking users like how things work right now.

Re: How to get the correct poster from TMDB?
The SpongeBob Movie: Sponge on the Run (2020)
https://www.themoviedb.org/movie/400160 ... /backdrops
eng 720p https://image.tmdb.org/t/p/original/zhC ... IQ5nhi.jpg
vs
xx 4k https://image.tmdb.org/t/p/original/wu1 ... 8gidHf.jpg
remember poster has title so no need for it on backdrop
e.g. can you see or read any text from backdrop ?
https://koditips.com/wp-content/uploads ... 1VSOzF.png
https://kodi.wiki/images/thumb/0/05/Art ... View01.jpg
https://www.themoviedb.org/movie/400160 ... /backdrops
eng 720p https://image.tmdb.org/t/p/original/zhC ... IQ5nhi.jpg
vs
xx 4k https://image.tmdb.org/t/p/original/wu1 ... 8gidHf.jpg
remember poster has title so no need for it on backdrop
e.g. can you see or read any text from backdrop ?
https://koditips.com/wp-content/uploads ... 1VSOzF.png
https://kodi.wiki/images/thumb/0/05/Art ... View01.jpg
Re: How to get the correct poster from TMDB?
This one does seem to be sorted in some sort of order again:
I guess we can try with leaving the original order in tact and picking the first one that matches our language preferences (or has no language explicitly, for backdrops) and then see how that goes.
EDIT:
As far as I can tell, the API simply sorts by vote_average and then pushes the results out. So it's not the same as the website, which does some additional sorting on top of that. Based on the test case above, I'm now calculating the rating with voteAverage * voteCount * height (so that large images get priority over similarly voted smaller ones). Implemented with FileBot r8155.
Code: Select all
{aspect_ratio=1.777777777777778, file_path=/wu1uilmhM4TdluKi2ytfz8gidHf.jpg, height=2160, iso_639_1=null, vote_average=5.384, vote_count=2, width=3840}
{aspect_ratio=1.777777777777778, file_path=/bt4xA9WZE9P1wiRILRFt0Zh2wmV.jpg, height=2160, iso_639_1=null, vote_average=5.246, vote_count=2, width=3840}
{aspect_ratio=1.777777777777778, file_path=/7KakIVhCsh28zNcoL3BJQjnyJMY.jpg, height=720, iso_639_1=null, vote_average=5.18, vote_count=3, width=1280}
{aspect_ratio=1.777777777777778, file_path=/hESI1Z8OMfj2xz22fAfCOnwyIXX.jpg, height=2160, iso_639_1=pt, vote_average=0.0, vote_count=0, width=3840}
{aspect_ratio=1.777777777777778, file_path=/zhCu4iJHSKBf4uAIQyaR5IQ5nhi.jpg, height=720, iso_639_1=en, vote_average=0.0, vote_count=0, width=1280}
{aspect_ratio=1.777777777777778, file_path=/5nHj5Yl44pAWb1rgPbZU01a15Bo.jpg, height=720, iso_639_1=null, vote_average=0.0, vote_count=0, width=1280}
{aspect_ratio=1.777777777777778, file_path=/jKCipHpHBbwlJO4QBKp7Ap0h2hL.jpg, height=720, iso_639_1=null, vote_average=0.0, vote_count=0, width=1280}
{aspect_ratio=1.777777777777778, file_path=/aoo0VIMD2iqt0ACP3XPnCIojy2J.jpg, height=1080, iso_639_1=fr, vote_average=0.0, vote_count=0, width=1920}
{aspect_ratio=1.777777777777778, file_path=/9qHMifmzwpp3diJde9ggoowEEsn.jpg, height=720, iso_639_1=fr, vote_average=0.0, vote_count=0, width=1280}
{aspect_ratio=1.777777777777778, file_path=/lbRZFOZIW0Ut7wcGAmDuvFPNnyp.jpg, height=2160, iso_639_1=null, vote_average=0.0, vote_count=0, width=3840}
EDIT:
As far as I can tell, the API simply sorts by vote_average and then pushes the results out. So it's not the same as the website, which does some additional sorting on top of that. Based on the test case above, I'm now calculating the rating with voteAverage * voteCount * height (so that large images get priority over similarly voted smaller ones). Implemented with FileBot r8155.
Re: How to get the correct poster from TMDB?
Code: Select all
<movie>
<name>Ryan Gosling</name>
<role>Neil Armstrong</role>
</movie>
Code: Select all
<actor>
<name>Ryan Gosling</name>
<role>Neil Armstrong</role>
<order>0</order>
<thumb>https://image.tmdb.org/t/p/original/lyUyVARQKhGxaxy0FbPJCQRpiaW.jpg</thumb>
</actor>
Code: Select all
<sorttitle>First Man</sorttitle>
Code: Select all
<sorttitle>First Man::2018-10-11</sorttitle>
Re: How to get the correct poster from TMDB?
Implemented with FileBot r8211.