jurialmunkey / script.skinvariables

A helper script for Kodi skinners to construct multiple variables
GNU General Public License v3.0
35 stars 17 forks source link

Get Encoded String (Container) seems not working with + #49

Closed Nanomani closed 1 week ago

Nanomani commented 1 month ago

Get Encoded String (Container) seems not working with +

RunPlugin("plugin://script.skinvariables/?info=get_encoded_string&window_id=Home&window_prop=Encoded.ListItem.Studio&&$INFO[ListItem.Studio]")

eg : if $INFO[ListItem.Studio]is "Paramout+"`

$INFO[Window(Home).Property(Encoded.ListItem.Studio)] must displayed "Paramount%2B"

but it don't there no change "Paramout+" is displayed

Anyway thanks a lot for all your addons.

Nanomani commented 1 week ago

If for you it is no sense or not clear or too many works for a limited case I understand. I guess the difficulty is how this works because in some case there is "+" in encoded value to replace a "space" So please feel free to close this issue :)

jurialmunkey commented 1 week ago

How are you testing this?

The function passes the string to pythons urllib encoding function (quote_plus) which should percent encode plus signs. The function encodes space to plus, and plus to percent.

It sounds like however you're testing this is decoding the string.

Nanomani commented 1 week ago

I use this feature "Get Encoded String" in "DialogVideoInfo.xml" with <onload> in same way for encode :

this help in some case to display list item by (set, studio) from my local db

SET

label.set contain sometime a & (eg : "fast & Furious - saga")

<onload>RunPlugin("plugin://script.skinvariables/?info=get_encoded_string&amp;window_id=Home&amp;window_prop=Encoded.ListItem.Set&amp;&amp;$INFO[ListItem.Set]")</onload>

For this case all works well :

2024-09-11_165438

STUDIO

label.studio contain sometime a + (eg : "Apple TV+")

<onload>RunPlugin("plugin://script.skinvariables/?info=get_encoded_string&amp;window_id=Home&amp;window_prop=Encoded.ListItem.Studio&amp;&amp;$INFO[ListItem.Studio]")</onload>

For this case this seems not working :

2024-09-11_150539

I guess it is big missunderstaning in my side. But I have absoluty no idea where I m wrong in my code ?

Anyway thanks again for your time and I will close this in few days.

Nanomani commented 1 week ago

STUDIO

Just to be sure of my code I have tested with a label.studio with some "Special Characters" but without +

eg : Agat Films & Cie / Ex Nihilo

All works fine :

2024-09-11_190645

definitively I don't understand why "+" is not encoded when is present in label ...

jurialmunkey commented 1 week ago

I think the + is being turned into a space before it reaches the script, and then the script encodes the space on the end as a +

jurialmunkey commented 1 week ago

Above commit adds an optional param unencoded_paths=true to prevent paths after && being decoded before running through the script (i.e. will prevent the + being decoded to a space before the script runs to encode it).

e.g. <onload>RunPlugin("plugin://script.skinvariables/?info=get_encoded_string&amp;unencoded_paths=true&amp;window_id=Home&amp;window_prop=Encoded.ListItem.Studio&amp;&amp;$INFO[ListItem.Studio]")</onload>

Nanomani commented 1 week ago

Perfect, everything is now working as planned. Thanks a lot.