elgatito / script.elementum.burst

Development of this addon has been stopped!
MIT License
118 stars 118 forks source link

how to send tmdb_id to a provider along with the title? #264

Closed movianlost closed 3 years ago

movianlost commented 3 years ago

I tried to add {tmdb_id} and {tmdb} into movie_keywords but these don't get translated into the movie's id unlike {title} and {year} which works just fine.

I have come across this old issue here: https://github.com/elgatito/script.elementum.burst/issues/180

In this issue @elgatito said "I have added tmdb_id and show_tmdb_id to the search payload in Elementum 0.1.51."

With Debug mode enabled, I can see that the payload contain these data, but I can't access them

elgatito commented 3 years ago

@movianlost keywords are placed in search query by a filtering.py script. Providers get all the information from Elementum, then have to deal with it.

movianlost commented 3 years ago

@elgatito Thank you very much, I added the case check for tmdb_id in filtering.py and now it works perfectly.

Another issue that I found that may sound minimal but it can have big impact in the results is a bug in translation.

I have Kodi set in FR-France (not FR-Canada) so when I go to Elementum everything is translated correctly using FR-FR, however, when I click on a movie like "Django Unchained" which is the correct title in FR-FR, the {title:fr} get replaced using FR-CA which is "Django dechaine", I went to tmdb API to look and I found that the title in FR-FR translation is empy there because FR-FR uses the original title and FR-CA has title:"Django dechaine".

I don't know how can Elementum UI have the correct name that is used in FR-France i.e. "Django Unchained', but when it sends the payload, the payload contains two entries 'fr':"Django Dechaine' and 'ca':'Django Dechaine'.

I suspect that when Elementum finds that there is no FR-FR translation for an item, it uses FR-CA as fallback, this is undesired because all French providers rely on FR-FR for correct title, and in France if the item title is short, they usually don't translate it, whereas in Canada they translate everything. And FR-CA title is useless when it comes French content.

This issue is only present when a title doesn't have translation in FR-FR while having translation in FR-CA. e.g. the movie "Wonder Woman 1984" doesn't have a translation in neither FR-FR nor FR-CA, when Elementum payload is sent, it sends the original title "Wonder Woman 1984" which is the correct behavior.

I think the correct behavior is to mimic the behavior of Elementum UI when it doesn't find FR-FR title it uses the original title and not the FR-CA.

elgatito commented 3 years ago

@movianlost There are hardcoded translations of language-region in Elementum. https://github.com/elgatito/elementum/blob/master/xbmc/types.go#L43

movianlost commented 3 years ago

When you translate a movie using tmdb api, each result contain iso_3166_1 and iso_639_1 code, the first is for the country code and the second is for the language code.

In your code, you are using the language code iso_639_1 to translate movie titles. The problem with this is that if you want to translate a movie to French, you get tmdb api results and you find there are two entries like this: {'iso_3166_1' : 'CA', 'iso_639_1' : 'FR'} //translation used in Canada {'iso_3166_1' : 'FR', 'iso_639_1' : 'FR'} //translation used in France

These two entries have completely different translation like they are different languages, so you can't rely on 'iso_639_1' for translation because the country is the one that set the title name not the language.

This is not limited to French, a language can be the official language in multiple countries, each country can have different title translation for the same movie although they share the same language. Another example is Chinese, the tmdb api translation returns:

{'iso_3166_1' : 'CN', 'iso_639_1' : 'ZH'} //translation used in Mainland China {'iso_3166_1' : 'TW', 'iso_639_1' : 'ZH'} //translation used in Taiwan {'iso_3166_1' : 'HK', 'iso_639_1' : 'ZH'} //translation used in Hong Kong

All of these results have completely different title for the same movie, so if you are programming Elementum to use iso_639_1 that is ZH for the translation, then you are not really specifying which translation to use.

For this I suggest that you use the country code 'iso_3166_1' as a basis for translation because this way you know there will be one unique translation for each movie.

In my testing, this makes a huge difference and it is one of the main reason why a lot of people complain that Elementum doesn't return the same results as the provider, and for me personally I get the results in yggtorrent but not in Elementum because Elementum sends the Canadian translation which is not used in any torrent site.

elgatito commented 3 years ago

@movianlost You speak about translating {title:fr} of Burst keywords into specific language locale?

elgatito commented 3 years ago

@movianlost v0.0.64 now has support for tmdb_id, imdb_id, tvdb_id, show_tmdb_id fields in keywords contructor.