xbmc / metadata.tvshows.themoviedb.org.python

themoviedb.org TV Show scraper in Python for Kodi 18 (Leia) or later.
GNU General Public License v3.0
20 stars 26 forks source link

Language setting being ignored #15

Closed KarellenX closed 4 years ago

KarellenX commented 4 years ago

From forum post... https://forum.kodi.tv/showthread.php?tid=357232&pid=2978421#pid2978421

A user has reported that he had set Russian language for The Simpsons but it was scraped in English.

I tested this with Russian and Italian and in both cases, English was scraped.

The log is here... https://paste.kodi.tv/gobebeqida.kodi

On line 3365 the scraper settings show ru-RU as the language On line 3368 the API URL is appended with en_US

Further is en_US correct? Should it be en-US instead? (hyphen, not underscore)

Also, I have IMDB ratings disabled in settings, and you can confirm that setting in line 3365, but IMDB ratings are still scraped as shown on line 3376.

pkscout commented 4 years ago

First the language string. I swear I saw in the TMDb docs that you are suppose to use the underscore, but the API test site uses dashes. Of course API test site also says to use 639-1 (which is a 2 character code, not the 4 character one), and the 4 character code seems to work with either dashes or underscores. But I changed it so the scraper doesn't convert the dash to an underscore anymore.

I think I figured out why the scraper is ignoring the settings. I didn't realize this, but there is a difference between the addon settings and the source settings. The addon settings are used as the "default" for any new source, but if you change the addon settings the source settings aren't changed. So right now I'm just reading the addon settings and using those. So if you add a source and change the settings, the scraper ignores the source changes and uses the addon settings. I'll get to work on fixing that.

pkscout commented 4 years ago

OK, this should fix both the language and IMDb setting issues you were seeing. Basically the scraper now looks at the source settings rather than the addon settings. I haven't pushed this into main or done a new release yet. Could you download from:

https://github.com/pkscout/metadata.tvshows.themoviedb.org.python/tree/lang-fixes

and check to make sure it's working as you expect? Thanks.

KarellenX commented 4 years ago

Thanks @pkscout

I set scraper to Italian, Spanish and Russian and the correct language was scraped for the tv show and episode metadata. Certifications were correct and Season posters were correct.

The only problem is the tv show poster. In all three test it scraped the English poster instead of the correct language poster. https://www.themoviedb.org/tv/456-the-simpsons/images/posters?image_language=ru&language=es-ES

pkscout commented 4 years ago

Yea, I was trying to fix another problem with the images. With the current release, if your language doesn't have any images and none are marked as NULL (i.e. not having a language), then you get no images at all. So for Firefly (as an example), almost all the posters are listed as English (and all the banners are), so you don't get much of anything if you pick French. To get around that, I added the English language along with the chosen language (and null), but now you get the English one by default. I think I'm going to back out the artwork change and push a release with the rest of the changes and then look at artwork again. Maybe I can reorder the artwork so that something in the chosen language (if available) is first.

pkscout commented 4 years ago

Fixed with 38b550fc814e50d3db5eb057faa1e65ca87c4dae.