The Movie Database Support

Site / API bug

I don't know where this error fits whether it is in Api or on the website. I'm using tmdbsimple, to manipulate the Api https://pypi.org/project/tmdbsimple/

the problem happens when inserting a new poster through the website, there is no Brazilian Portuguese language option. Only Portuguese

https://ibb.co/FbR289n

this creates a problem in the Api. when searching for a poster using the pt-br language, no image appears in Api's response.

pt-br (BrazilianPortuguese): https://api.themoviedb.org/3/tv/63038/images?api_key=*********&language=pt-br

json:

{'backdrops': [], 'id': 63038, 'posters': []
}

When I search using the pt language, two options appear and I cannot select the second image.

pt (Portuguese): https://api.themoviedb.org/3/tv/63038/images?api_key=*********&language=pt

json:

{'backdrops': [], 'id': 63038, 'posters': [
        {'aspect_ratio': 0.68, 'file_path': '/dcCuzPJS5gDahHixXw9oHjh8rUW.jpg', 'height': 1000, 'iso_639_1': 'pt', 'vote_average': 0.0, 'vote_count': 0, 'width': 680
        },
        {'aspect_ratio': 0.68, 'file_path': '/ntgFg3wq5EqKRAy9IQKIWQqMQv5.jpg', 'height': 1000, 'iso_639_1': 'pt', 'vote_average': 0.0, 'vote_count': 0, 'width': 680
        }
    ]
}

Python code:


import os
os.environ["PYTHONIOENCODING"] = "utf-8"

import tmdbsimple as tmdb
myKey = '*********' #api key
tmdb.API_KEY = myKey

URLTMDBPOSTER = 'https://image.tmdb.org/t/p/w500'
URLNOPOSTER = 'https://nocover.png'

tvg_tmdbid = '63038'
if tvg_tmdbid != None and str(tvg_tmdbid).strip() != '':
    poster = ''

    #print(tmdb.TV(tvg_tmdbid).images(language='pt-br'))

    #search the poster in pt-br
    lstposters_mylang = []
    lstposters_mylang = tmdb.TV(tvg_tmdbid).images(language='pt-br')['posters'] #pt-BR no image
    #lstposters_mylang = tmdb.TV(tvg_tmdbid).images(language='pt')['posters'] #pt : two images
    if lstposters_mylang != []:
        posterpath = lstposters_mylang[0]['file_path']
        posterpath = posterpath.strip()
        if posterpath != '' and posterpath != 'null' and posterpath != '0':
            poster = posterpath

    #when there is no poster in pt-br it makes the search for image without language
    else:
        lstposters_en = []  
        lstposters_en = tmdb.TV(tvg_tmdbid).images()['posters']
        if lstposters_en != []:
            posterpath = lstposters_en[0]['file_path']
            posterpath = posterpath.strip()
            if posterpath != '' and posterpath != 'null' and posterpath != '0':
                poster = posterpath

    #no posters registered
    if poster == '':
        poster = URLNOPOSTER
        print(poster)
    else:
        print(URLTMDBPOSTER + poster)

5 replies (on page 1 of 1)

Jump to last post

@antrrax said:
There is no option to insert an Poster in Brazilian Portuguese [pt-BR]
Site / API bug
pt-br (BrazilianPortuguese):
https://api.themoviedb.org/3/tv/63038/images?api_key=*********&language=pt-br

pt (Portuguese):
https://api.themoviedb.org/3/tv/63038/images?api_key=*********&language=pt

No, it is not possible.
Posters cannot yet have a country of origin. Only the language.
There are plans to add this feature but I don't know what position is on the ToDo list.

Maybe you’re interested in knowing.
If you do not use the language parameter, you will receive all images.

https://api.themoviedb.org/3/tv/63038/images?api_key=THE_KEY

To Do List
See here https://trello.com/c/pHOJdjPj/73-add-region-variant-to-image-languages
I'm sorry to inform you but it's there at the end of the line. :-(
You can vote. Most voted have preference.

And how does the site define the poster that will be displayed for the language? https://www.themoviedb.org/tv/60948-12-monkeys?language=pt-BR

for me when I open the site this poster image appears: https://image.tmdb.org/t/p/w600_and_h900_bestv2/lnLlxi9GcPNyLcmvt6uVipI73m5.jpg

however in the search for the api's python code, if I use the pt-br language, there is no image.

if I search with the pt language, this image appears [first position on the list]: https://image.tmdb.org/t/p/w500/kuiSCE5xfZspVqU7vAyQ377YIU6.jpg

if I search without language, this image appears [first position on the list]: https://image.tmdb.org/t/p/w500/w5u1PqBYfDyfrlkxADTA38jYG3I.jpg

that is, neither of the two images the answer of the python code coincides with the standard image of the site

Does it default to use the last item on the list in a particular language?

@antrrax said:

And how does the site define the poster that will be displayed for the language?
https://www.themoviedb.org/tv/60948-12-monkeys?language=pt-BR

It is the most voted image in your web interface language.
If not in your language, the most voted in the original language of the film.
If not, the most voted image of the film, regardless of language.

for me when I open the site this poster image appears:
https://image.tmdb.org/t/p/w600_and_h900_bestv2/lnLlxi9GcPNyLcmvt6uVipI73m5.jpg

For me it's the same.

however in the search for the api's python code, if I use the pt-br language, there is no image.

Just remembering. The country code must be capitalized. BR and not br.

if I search with the pt language, this image appears [first position on the list]: https://image.tmdb.org/t/p/w500/kuiSCE5xfZspVqU7vAyQ377YIU6.jpg

I receive the path of 3 images, in this order below.
The first is the same as the website.

https://api.themoviedb.org/3/tv/60948/images?api_key=THE_KEY&language=pt  
file_path   "/lnLlxi9GcPNyLcmvt6uVipI73m5.jpg"  
file_path   "/kuiSCE5xfZspVqU7vAyQ377YIU6.jpg"  
file_path   "/9ThglVQvuExDvTOx3weUJVupCZH.jpg"  

if I search without language, this image appears [first position on the list]: https://image.tmdb.org/t/p/w500/w5u1PqBYfDyfrlkxADTA38jYG3I.jpg

I get the path of 43 backdrops and 35 posters.
The first poster is the one below, language en

0   
aspect_ratio    0.6666666666666666
file_path   "/w5u1PqBYfDyfrlkxADTA38jYG3I.jpg"
height  1530
iso_639_1   "en"
vote_average    5.39
vote_count  6
width   1020

that is, neither of the two images the answer of the python code coincides with the standard image of the site
Does it default to use the last item on the list in a particular language?

I believe it is the first image path. Not the last.

I'm following that order that you said,

  1. first I search in my language pt,
  2. if you do not have posters in pt I search in the original language,
  3. if there is also no poster, I search without language.

always with the poster with the highest 'vote_average'.

The problem is that many posters have the same 'vote_average' and the same 'vote_count'. Then I didn't understand what programming logic TMBD uses in these cases to determine the cover that it will use on the website.

see 3 situations below in three different series each of the three situations proposed by you to define the cover. See that they do not match the site:

Language Search: "pt"

Serie: Raven's Home

Site: https://www.themoviedb.org/tv/72027?language=pt-BR

Api: https://api.themoviedb.org/3/tv/72027/images?api_key=***&language=pt

Poster via Python: https://image.tmdb.org/t/p/w500/e8ntXD3siE0NAYwnTGncwKpIGLz.jpg

Poster via Web: https://image.tmdb.org/t/p/w600_and_h900_bestv2/4skN0reX3aoPWTAAcgFkkaQjv8R.jpg

[
    {'aspect_ratio': 0.6666666666666666, 'file_path': '/e8ntXD3siE0NAYwnTGncwKpIGLz.jpg', 'height': 3000, 'iso_639_1': 'pt', 'vote_average': 5.312, 'vote_count': 1, 'width': 2000
    },
    {'aspect_ratio': 0.6666666666666666, 'file_path': '/4skN0reX3aoPWTAAcgFkkaQjv8R.jpg', 'height': 3000, 'iso_639_1': 'pt', 'vote_average': 5.312, 'vote_count': 1, 'width': 2000
    },
    {'aspect_ratio': 0.6666666666666666, 'file_path': '/goMyHbMg6FbOYBfsy0phYpqWJh0.jpg', 'height': 900, 'iso_639_1': 'pt', 'vote_average': 5.246, 'vote_count': 2, 'width': 600
    },
    {'aspect_ratio': 0.6666666666666666, 'file_path': '/wY3QsksGWaKdb69yUgZB82LYijV.jpg', 'height': 1440, 'iso_639_1': 'pt', 'vote_average': 5.172, 'vote_count': 1, 'width': 960
    }
]

Language Search: "en"

Serie: 666 Park Avenue

Site: https://www.themoviedb.org/tv/43188?language=pt-BR

Api: https://api.themoviedb.org/3/tv/43188/images?api_key=***&language=en

Poster via Python: https://image.tmdb.org/t/p/w500/rPHBEHNNhITkfOlXkRQk3xgwCZQ.jpg

Poster via Web: https://image.tmdb.org/t/p/w600_and_h900_bestv2/gYZGZlONvtpCzMcjvXFiE8EGGNu.jpg

[
    {'aspect_ratio': 0.68, 'file_path': '/gYZGZlONvtpCzMcjvXFiE8EGGNu.jpg', 'height': 1000, 'iso_639_1': 'en', 'vote_average': 0.0, 'vote_count': 0, 'width': 680
    },
    {'aspect_ratio': 0.68, 'file_path': '/rPHBEHNNhITkfOlXkRQk3xgwCZQ.jpg', 'height': 1000, 'iso_639_1': 'en', 'vote_average': 0.0, 'vote_count': 0, 'width': 680
    },
    {'aspect_ratio': 0.68, 'file_path': '/gWBT8NpjeoPlOq6GtwiNVzCuukX.jpg', 'height': 1000, 'iso_639_1': 'en', 'vote_average': 0.0, 'vote_count': 0, 'width': 680
    }
]

Language Search: "nothing"

Serie: Borgia

Site: https://www.themoviedb.org/tv/34388?language=pt-BR

Api: https://api.themoviedb.org/3/tv/34388/images?api_key=***

Poster via Python: https://image.tmdb.org/t/p/w500/wKkRL7EJ7Sz7aos1JKbdyZ2IGVr.jpg

Poster via Web: https://image.tmdb.org/t/p/w600_and_h900_bestv2/AmC9gZPONdqpaiLU2mISEYBMYyE.jpg

[
    {'aspect_ratio': 0.68, 'file_path': '/voxBL1kCVc5QmbtiXgB9rzY7kyz.jpg', 'height': 1000, 'iso_639_1': None, 'vote_average': 0.0, 'vote_count': 0, 'width': 680
    },
    {'aspect_ratio': 0.68, 'file_path': '/wKkRL7EJ7Sz7aos1JKbdyZ2IGVr.jpg', 'height': 1000, 'iso_639_1': None, 'vote_average': 0.0, 'vote_count': 0, 'width': 680
    },
    {'aspect_ratio': 0.68, 'file_path': '/jrLEvAT3DxgzC5QeAWkHHHQAHMH.jpg', 'height': 1000, 'iso_639_1': None, 'vote_average': 0.0, 'vote_count': 0, 'width': 680
    },
    {'aspect_ratio': 0.68, 'file_path': '/AmC9gZPONdqpaiLU2mISEYBMYyE.jpg', 'height': 1000, 'iso_639_1': None, 'vote_average': 0.0, 'vote_count': 0, 'width': 680
    },
    {'aspect_ratio': 0.68, 'file_path': '/aXVbghgAZIPfESxJE34ntTRCTg4.jpg', 'height': 1000, 'iso_639_1': None, 'vote_average': 0.0, 'vote_count': 0, 'width': 680
    },
    {'aspect_ratio': 0.68, 'file_path': '/divTL0hMsmtE2NguqY2l90lXRKv.jpg', 'height': 1000, 'iso_639_1': None, 'vote_average': 0.0, 'vote_count': 0, 'width': 680
    }
]

python code I used:

import os
os.environ["PYTHONIOENCODING"] = "utf-8"

import tmdbsimple as tmdb
myKey = '***' #api key
tmdb.API_KEY = myKey

URLTMDBPOSTER = 'https://image.tmdb.org/t/p/w500'
URLNOPOSTER = 'https://nocover.png'
tmdb_poster_lang = 'pt'

#tvg_tmdbid = '72027'
#tvg_tmdbid = '43188'
tvg_tmdbid = '34388'

if tvg_tmdbid != None and str(tvg_tmdbid).strip() != '':
    poster = ''

    tmdb_serie = tmdb.TV(tvg_tmdbid)
    tmdb_infos = tmdb_serie.info()

    # Search poster in language: {tmdb_poster_lang}
    lst_posters_mylang = []
    lst_posters_mylang = tmdb_serie.images(language=tmdb_poster_lang)['posters']
    if lst_posters_mylang != []:
        posterpath = max((x['vote_average'], x['file_path']) for x in lst_posters_mylang)[1]
        posterpath = posterpath.strip()
        if posterpath != '' and posterpath != 'null' and posterpath != '0':
            poster = posterpath
            print(f'Language Search: "{tmdb_poster_lang}"\n')
            print(f"Serie: {tmdb_infos['original_name']}\n")
            print(f'Site: https://www.themoviedb.org/tv/{tvg_tmdbid}?language=pt-BR\n')
            print(f'Api: https://api.themoviedb.org/3/tv/{tvg_tmdbid}/images?api_key={myKey}&language={tmdb_poster_lang}\n')
            print(f'Poster via Python: {URLTMDBPOSTER}{poster}\n')
            print(f'Poster via Web: \n\n')
            print(lst_posters_mylang)

    #when there is no poster in {tmdb_poster_lang} it makes the search for original language
    else:
        original_language = tmdb_infos['original_language']
        if tmdb_poster_lang == original_language: original_language = ''

        lst_posters_original_lang = []
        lst_posters_original_lang = tmdb_serie.images(language=original_language)['posters']
        if lst_posters_original_lang != []:
            posterpath = max((x['vote_average'], x['file_path']) for x in lst_posters_original_lang)[1]
            posterpath = posterpath.strip()
            if posterpath != '' and posterpath != 'null' and posterpath != '0':
                poster = posterpath
                print(f'Language Search: "{original_language}"\n')
                print(f"Serie: {tmdb_infos['original_name']}\n")
                print(f'Site: https://www.themoviedb.org/tv/{tvg_tmdbid}?language=pt-BR\n')
                print(f'Api: https://api.themoviedb.org/3/tv/{tvg_tmdbid}/images?api_key={myKey}&language={original_language}\n')
                print(f'Poster via Python: {URLTMDBPOSTER}{poster}\n')
                print(f'Poster via Web: \n\n')
                print(lst_posters_original_lang)

        #when there is no poster in {tmdb_poster_lang} and original language it makes the search for image without language
        else:
            lst_posters_nolang = []
            lst_posters_nolang = tmdb_serie.images()['posters']
            if lst_posters_nolang != []:
                posterpath = max((x['vote_average'], x['file_path']) for x in lst_posters_nolang)[1]
                posterpath = posterpath.strip()
                if posterpath != '' and posterpath != 'null' and posterpath != '0':
                    poster = posterpath
                    print(f'Language Search: "nothing"\n')
                    print(f"Serie: {tmdb_infos['original_name']}\n")
                    print(f'Site: https://www.themoviedb.org/tv/{tvg_tmdbid}?language=pt-BR\n')
                    print(f'Api: https://api.themoviedb.org/3/tv/{tvg_tmdbid}/images?api_key={myKey}\n')
                    print(f'Poster via Python: {URLTMDBPOSTER}{poster}\n')
                    print(f'Poster via Web: \n\n')
                    print(lst_posters_nolang)  

    #no posters registered
    if poster == '':
        poster = URLNOPOSTER
        print(poster)

Would you know a simple way to get tmdbsimple's response to match that of the poster website?

PS: I think that should be something simple. Api should deliver this ready, without having to be programming on the user's side. Api itself should already put the standard cover on some element so that we can do this direct extraction.

I think I was not able to be clear.
You asked me:

And how does the site define the poster that will be displayed for the language?

And I answered:

It is the most voted image in your web interface language.
If not in your language, the most voted in the original language of the film.
If not, the most voted image of the film, regardless of language.

I thought I had been clear.
This is the rule that the TMDb system uses to define or choose which poster will appear as the main one on the film page.
Therefore, if you make the Basic API Request, this is the Poster you will receive.
https://api.themoviedb.org/3/tv/60948?api_key=THE_KEY&language=pt
"poster_path": "/lnLlxi9GcPNyLcmvt6uVipI73m5.jpg",
"backdrop_path": "/A8YaRkWQDlu4ANprW14RJkcI1nq.jpg",

Would you know a simple way to get tmdbsimple's response to match that of the poster website?

At first I imagined that, since you were requesting only images, your interest was to receive several images.
But now it seems to me that you only want the Poster and eventually the Backdrop, which appear on the page of the film or series.
So, if that's true, I think the Basic API Request will solve your problem.

Can't find a movie or TV show? Login to create it.

Global

s focus the search bar
p open profile menu
esc close an open window
? open keyboard shortcut window

On media pages

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(right arrow) go to next season
(left arrow) go to previous season

On TV episode pages

(right arrow) go to next episode
(left arrow) go to previous episode

On all image pages

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

On discussion pages

n create new discussion
w toggle watching status
p toggle public/private
c toggle close/open
a open activity
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(right arrow) next page
(left arrow) previous page

Settings

Want to rate or add this item to a list?

Login