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]: Property mismatch between self._language and self.language #7

Closed mchangrh closed 1 year ago

mchangrh commented 1 year ago

Version Number

v1.0.8

Describe the Bug

The object API defaults language to 'en' which conflicts with the behaviour in the raw API, defaulting to None.

the self._language property is validated and passed through the setter/getter but not passed on the actual API calls, self.language is used instead, which is not validated and is passed as an argument by the user and defaults to 'en'

This leads to discrepancies in the API where the raw v3 API will not include the language and correctly pull all images, while the object API will be limited to the 'en' backdrops. None is also not a valid language as per the setter, making it impossible to override manually.

This is most likely connected to #5 and a fix was attempted in #6 but I clearly misunderstood which property was supposed to be used.

MCVE to demonstrate the differences:

from tmdbapis import TMDbAPIs, api3

apikey = ""
tvid = 202102

objapi = TMDbAPIs(apikey)
obj_show = objapi.tv_show(tvid)

rawapi = api3.API3(apikey)
raw_show = rawapi.tv_get_images(tvid)

def path_only(backdrop):
    return backdrop['file_path'], backdrop['iso_639_1']

print("obj backdrops")
print(obj_show.backdrops)
print("raw backdrops")
print(list(map(path_only, raw_show['backdrops'])))
obj backdrops
[[Backdrop:/1LeXSX1Z7PsWmb4x6SRB61c4dfk.jpg], [Backdrop:/gewfanBcat8DC8hG9rZ64bYI6W2.jpg], [Backdrop:/sj1UGxYusH3oPxNkR0JuJj1eHed.jpg], [Backdrop:/urfRutUKyn4hywQvYS7k0SEzfnT.jpg], [Backdrop:/2wiqHO9l9qoCr9ERDwA1LULsQxd.jpg]]
raw backdrops
[('/aAwtr0pj9jt3DnhTNltOoaOrnk1.jpg', None), ('/1LeXSX1Z7PsWmb4x6SRB61c4dfk.jpg', 'en'), ('/gewfanBcat8DC8hG9rZ64bYI6W2.jpg', 'en'), ('/3R38NDSDituhQDxy24SYG1Q7j9c.jpg', None), ('/sj1UGxYusH3oPxNkR0JuJj1eHed.jpg', 'en'), ('/urfRutUKyn4hywQvYS7k0SEzfnT.jpg', 'en'), ('/2wiqHO9l9qoCr9ERDwA1LULsQxd.jpg', 'en'), ('/c0hBEOLW0CJFELk72BtUdaa3kV2.jpg', None), ('/pz4NEoIn8RHtHqGOXGLejy7hoRt.jpg', None)]
CollinHeist commented 1 year ago

To add to this - the GET request submitted via the API3 object is being passed a language=en argument, which is causing the mismatch.

meisnate12 commented 1 year ago

should all be fixed in 1.1.0

mchangrh commented 1 year ago

Thanks!