Plugin.video.themoviedb.helper: Language support

Created on 16 Nov 2020  路  23Comments  路  Source: jurialmunkey/plugin.video.themoviedb.helper

Is it possible to add an option to search by title in different lang?
something like:
"language": string [optional, default="en"]
Language to use for parameters.

that used to be on openmeta

Most helpful comment

Ah okay, so you want to be able to retrieve the translated title of the movie/show to be able to pass to the player. I should be able to add an option for this.

All 23 comments

I think you should be able to do this with Discover, no?

I tried looking at it:
https://github.com/jurialmunkey/plugin.video.themoviedb.helper/wiki/Lists-Discover

I dont see language,. In addition, can i use it within players?

Ah, no... it's not something you use with players. I didn't realize that was what you were referring to.

I don't understand what the use case is here? What are you trying to achieve?

Also, you can already set a language in the TMDbHelper settings. The language you use changes the language requests on TMDb. What are you trying to do that can't already be done simply by changing your language in the addon's settings?

Most of my searches/addons are in english.
I have one specific addon that i want to search in another language in it.
this is an example of an old working openmeta player piece of code:
https://pastebin.com/raw/C08fcz79

I tried to create a player for the first step to start with:
https://pastebin.com/raw/6QXtadzY

But i cant define language for this search only.

Ah okay, so you want to be able to retrieve the translated title of the movie/show to be able to pass to the player. I should be able to add an option for this.

Thank you very much!
another thing, In the original player I see there are 3 different searches for one TV show, I guess it is treated like "OR" between them.

Is this method supported in this addon as well?

Okay v4.0.53 should add language support for players.

Specify the iso_639_1 two letter language code in the player file e.g. for German (de) we would do:

{
    "name"              : "YouTube",
    "language"          : "de",
    "plugin"            : "plugin.video.youtube",

Specifying the language causes the player to do an additional request to grab the translations. The translated keys have the language code at the front like so {de_title} {de_plot} etc. That way you can mix and match keys for the specified language and the default language, which might be useful for regex conditionals.

The keys that get translated values are: title showname clearname tvshowtitle name plot

The various encoded versions of the keys are also available, e.g.
{de_title_-} {de_title_escaped} {de_title_meta_url+} etc.

If there was no translation available then the key will fallback to the default value in default language setting.

Thanks a lot for the quick fix.
I'm still having problems though, I changed the player to look like this:
https://pastebin.com/raw/fTPGF693

but when I see the keyboard pops out I can see it still searches for the name in English. this is the correct iso code for hebrew so no reason to fallback..

Am I doing something wrong here?

Do you also have "language": "he" at the top of the player?

Also, what are you trying to play? Possible that TMDb doesn't have a translation for that item.

Also that is not the correct use of the position tag. Position tag only takes a number.

Yes i have:
"language": "he"

and I found the translation on tmdb.

BTW how can I set a step to enter a menu item that his name matches the regex? should i always relay on title? because im not sure it the rest of the attributes exists

and I found the translation on tmdb.

Can you please tell me what you are trying to play so that I can test...

BTW how can I set a step to enter a menu item that his name matches the regex? should i always relay on title? because im not sure it the rest of the attributes exists

Yes, you should match against title. Look at the built in Netflix and Youtube players for examples
https://github.com/jurialmunkey/plugin.video.themoviedb.helper/blob/master/resources/players/netflix.json
https://github.com/jurialmunkey/plugin.video.themoviedb.helper/blob/master/resources/players/youtube.json

You need to replace the "position" parts in your snippet with the listitem infolabel you want to match against - e.g.:

 "play_episode"      : [
    "plugin://plugin.video.XXXX/search/0",
    {"keyboard": "{he_clearname}"},
    {"title": "{he_clearname}-.*|.*-{he_clearname}|{he_clearname} {year}-.*|.*-{year} {he_clearname}"},
    {"season": "{season}"},
    {"episode": "{episode}"}
 ]

If the plugin doesn't have season/episode values then try to match the title e.g.

    {"title": "注讜谞讛 {season}"},
    {"title": "驻专拽 {episode}"}

In very rare cases you might need to match against "label" instead of "title"

Got it,
Thanks,
Unfortunately, I have the updated version from this repo after your fix but the search string is still in hebrew.
I checked for translation and found it on tmdb. this is how my player looks like:
https://pastebin.com/raw/hSMjiHWU

nothing found on logs with debugging enabled
Maybe its related to encoding? maybe because hebrew is RTL?

For the third time, can you PLEASE tell me what show you are trying to play so that I can test...

Also, what are you trying to play?

Can you please tell me what you are trying to play so that I can test...

Sorry, I honestly missed it.
I searched for "game of thrones" for example

I've done a bunch of tests with this and it working perfectly fine for me. I made a test player with "language": "he" and used "{he_clearname}" on an episode of Game of Thrones and it outputted 诪砖讞拽讬 讛讻住 where ever I put that format key.

Are you sure you don't have another copy of your player file somewhere that is overriding the one you are testing?

A good way to test that you are definitely using the player you are testing is to change the name field. e.g. If I was testing a Youtube player I'd change it to "name": "Youtube (Testing)" so that will show up in the player selection dialog.

I found the problem.
I modified the player via plugins settings and I didn't realize it doesn't update the player file itself.
Once I have done "reset player to default" I can see Hebrew.

I can actually see the keyboard popping out and I can see the search phrase - problem is that it is mirrored (RTL language :). I see

住讻讛 讬拽讞砖诪

instead of

诪砖讞拽讬 讛讻住

and I guess that's why nothing found

I guess it also happens during the navigation steps, it searches for

讛谞讜注

instead of

注讜谞讛

etc

The text is correct direction for the steps because I outputted the formatted string to the log and it was correctly mirrored. I don't think this is an issue with anything I'm doing specifically. I think this might be some issue to do with the InputText part of Kodi's JSONRPC module.

I saw this post on Kodi forums which judging from the username I'm guessing might also be you? It's the exact same issue as here using same method to input text.
https://forum.kodi.tv/showthread.php?mode=linear&tid=358530&pid=2989777

Is there some plugin end point that you can use where you can pass the search query directly instead of using the keyboard?

It is me.
I guess it is related to jsonrpc InputText.
I used an ugly workaround to fix this, just check if its an rtl language (hebrew, arabic) and if it is, i just mirror the input back

https://github.com/vlmaksime/plugin.video.united.search/pull/2/files

This addon does not support direct searching thats why im forced to use steps

Okay lets try with this commit (latest master) ^^^

Can now add optional "direction": "rtl" in player to keyboard step which will reverse slice the string before sending to RPC

{"keyboard": "{he_clearname}", "direction": "rtl"}

Works great! thank you very much for your help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Blurayx picture Blurayx  路  7Comments

alKODIque picture alKODIque  路  5Comments

drinfernoo picture drinfernoo  路  7Comments

Blurayx picture Blurayx  路  9Comments

SerpentDrago picture SerpentDrago  路  4Comments