$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:-

xml:
<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:-

xml:
<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

python:
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>
Main: Lancool II Mesh  - Ryzen 9 5900x - MSI x570 Unify - Zotac RTX 3080 AMP HOLO - 32GB Trident Z Neo 3600 CL16 -  EVO 960 M.2 250GB / EVO 940 250GB / MX100 512GB /  Crucial P1 2TB / WD Blue 3D Nand 2TB 
Sound: Saxx AS30 DSP - Beyer Dynamic Custom One Pro 
TV: Nvidia Shield 2019 Pro- Adalight 114x LEDs - Sony 65XG9505 - Kodi / Emby - Yamaha RX-V683 - Heco Victa 700/101/251a + Dynavoice Magic FX-4
Server: i3 Skylake - 8GB - OMV4 - 22TB Storage
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
Main: Lancool II Mesh  - Ryzen 9 5900x - MSI x570 Unify - Zotac RTX 3080 AMP HOLO - 32GB Trident Z Neo 3600 CL16 -  EVO 960 M.2 250GB / EVO 940 250GB / MX100 512GB /  Crucial P1 2TB / WD Blue 3D Nand 2TB 
Sound: Saxx AS30 DSP - Beyer Dynamic Custom One Pro 
TV: Nvidia Shield 2019 Pro- Adalight 114x LEDs - Sony 65XG9505 - Kodi / Emby - Yamaha RX-V683 - Heco Victa 700/101/251a + Dynavoice Magic FX-4
Server: i3 Skylake - 8GB - OMV4 - 22TB Storage
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