Kometa-Team / TMDbAPIs

A lightweight Python library for TMDb V3 and V4 APIs.
https://tmdbapis.metamanager.wiki
MIT License
11 stars 0 forks source link

[Bug]: Movie backdrops not returned #5

Closed CollinHeist closed 1 year ago

CollinHeist commented 1 year ago

Version Number

v1.0.8

Describe the Bug

Movie objects are being returned without any backdrops, despite them being present for the movie itself (and returned via the API). For example, for this movie:

from tmdbapis import TMDbAPIs
from requests import get

api_key = ''
api = TMDbAPIs(api_key)
print(api.movie(315162).backdrops)
# []

print(get(f'http://api.themoviedb.org/3/movie/315162/images?api_key={api_key}').json()['backdrops'])
# [{'aspect_ratio': 1.778, 'height': 1080, 'iso_639_1': None, 'file_path': '/cP8YNG3XUeBmO8Jk7Skzq3vwHy1.jpg', 'vote_average': 5.384, 'vote_count': 2, 'width': 1920},
#  {'aspect_ratio': 1.778, 'height': 720, 'iso_639_1': None, 'file_path': '/qLE8yuieTDN93WNJRmFSAEJChOg.jpg', 'vote_average': 5.384, 'vote_count': 2, 'width': 1280},
#  {'aspect_ratio': 1.778, 'height': 1080, 'iso_639_1': None, 'file_path': '/uUCc62M0I3lpZy0SiydbBmUIpNi.jpg', 'vote_average': 5.312, 'vote_count': 1, 'width': 1920},
#  {'aspect_ratio': 1.778, 'height': 1080, 'iso_639_1': None, 'file_path': '/r9PkFnRUIthgBp2JZZzD380MWZy.jpg', 'vote_average': 5.312, 'vote_count': 1, 'width': 1920},
#  {'aspect_ratio': 1.778, 'height': 1080, 'iso_639_1': None, 'file_path': '/tGwO4xcBjhXC0p5qlkw37TrH6S6.jpg', 'vote_average': 5.312, 'vote_count': 1, 'width': 1920},
#  {'aspect_ratio': 1.778, 'height': 1080, 'iso_639_1': None, 'file_path': '/faXT8V80JRhnArTAeYXz0Eutpv9.jpg', 'vote_average': 5.312, 'vote_count': 1, 'width': 1920},
#  {'aspect_ratio': 1.778, 'height': 1099, 'iso_639_1': None, 'file_path': '/fnfirCEDIkxZnQEtEMMSgllm0KZ.jpg', 'vote_average': 5.246, 'vote_count': 2, 'width': 1954}]

This occurs even if you reload the Movie object.

meisnate12 commented 1 year ago

just saw this @CollinHeist ill look into next week

meisnate12 commented 1 year ago

so yea it's all because of language

you can see the exact calls being made if you add the following to the beginning of your code

import logging

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())

so like @mchangrh said its because I'm also passing the parameter language.

I've removed defaulting to English youll now have to set the language.

I've also made include_language a property.

So if you set language to en and then include_language to null youll get all english and no language backdrops but if you do nothing you should now get all backdrops