$ESCINFO doesn't seem to work
#1
I'm passing Container.ShowName into a custom script  to fill the content of a list like so:-

<content type="video">plugin://script.seasonjump/?action=getSeasons&showName=$INFO[Container.ShowTitle]</content>

However it fails if any of the Show Titles contain an & symbol, which is to be expected, & symbols separate the parameters. 

So looking at the wiki I see there is an $ESCINFO version of $INFO, but changing my code to:-

<content type="video">plugin://script.seasonjump/?action=getSeasons&showName=$ESCINFO[Container.ShowTitle]</content>

Still does not work, the & symbols aren't being escaped Sad Any ideas on how to deal with this? Thanks


Edit:- So again it's just easier to do this in python using

showTitle = xbmc.getInfoLabel('Container.ShowTitle')

Still doesn't explain why $ESCINFO fails to escape the string properly.
Reply
#2
$ESCINFO just escapes the whole string.

Code:
Superduperstring, with special chars & other stuff
->
Code:
"Superduperstring, with special chars & other stuff"

In my Embuary helper script I use a small helper function to clean this quoted string:
Code:

def remove_quotes(label):
    if not label:
        return ''

    if label.startswith("'") and label.endswith("'") and len(label) > 2:
        label = label[1:-1]

        if label.startswith('"') and label.endswith('"') and len(label) > 2:
            label = label[1:-1]
        elif label.startswith('&quot;') and label.endswith('&quot;'):
            label = label[6:-6]

    return label

To prevent any other issues you have to quote it twice for your content call. Like so:
Code:
<content type="video">plugin://script.seasonjump/?action=getSeasons&showName='$ESCINFO[Container.ShowTitle]'</content>
or
Code:
<content type="video">plugin://script.seasonjump/?action=getSeasons&showName='"$INFO[Container.ShowTitle]"'</content>
Embuary | Skin | Helper | Info | Repo | GitHub
Reply
#3
Thank you for the reply, but unfortunately when dealing with url's and query strings wrapping the value in quotes won't work.

plugin://script.seasonjump/?action=someaction&title=sometitle

This is effectively a url and a query string, and the query strings parameters are separated by an & symbol, so if you want to include an & symbol in the value of one of the parameters then it needs to be correctly encoded. No amount of wrapping it in quotes will do this.

For instance, and I have tested this.

?action=action1&title=my title

Gets split into:
ParamValue
actionaction1
titlemy title

?action=action1&title=my title & some more

Gets split into:
ParamValue
actionaction1
titlemy title
Exactly the same because the extra & some more gets split into a new parameter with no value

Now if we wrap it in quotes like you suggest then
?action=action1&title='"my title & some more"'

Gets split into:
ParamValue
actionaction1
title'"my title

In order for it to work the & symbol needs to be properly encoded into %26 which $ESCINFO or wrapping with quotes does not do Sad
Reply
#4
I'm using something like this:

https://github.com/sualfred/script.embua...py#L27-L41
Embuary | Skin | Helper | Info | Repo | GitHub
Reply
#5
(2020-07-23, 22:39)sualfred Wrote: I'm using something like this:

https://github.com/sualfred/script.embua...py#L27-L41

Thanks
Reply



Logout Mark Read Team Forum Stats Members Help
$ESCINFO doesn't seem to work0
This forum uses Lukasz Tkacz MyBB addons.