Include $PARAM not being evaluated
#1
I have a strange situation, seems like a bug but don't see a reason for it.

I was refactoring some code.  I cut and pasted some code from an include and created a new parameterized include and called it from the original include.  I couldn't get it to show up.  I experimented with various things (nothing showed up in debug logs).  I could see the new include worked fine if I didn't define a parameter, but with a parameter it was no-go.

So I stripped it down to what seemed like minimum functionality and made a label display $PARAM[param_name]
what I saw is that $PARAM wasn't being evaluated, instead it was just being passed as a string to the label.  So I did a bunch more testing to see what was happening, created an include from scratch that worked fine.  At that point I was ready to post here for help.  So I could post the code I cleaned it up some including removing a comment from a line.  When I went to check to make sure my code still ran (with bug) to my surprise now $PARAM was being evaluated!  I've checked this comment decoded from utf-8 etc and there's no hidden or non-spacing chars or anything else strange about this comment.  I can't see any reason why the comment would somehow affect just the $PARAM eval and everything else works just fine.   Here's the test include which I also verified in Estuary placing it in Includes.xml:
Code:
    <include name="Test_param">
        <param name="sety">100</param>
        <definition>
        <control type="grouplist"><!-- labels higher when no lang or subs flags -->
                <posx>800</posx>
                <posy>100</posy>
                <width>500</width>
                <height>1080</height>
                <orientation>vertical</orientation>
                <itemgap>0</itemgap>
                <control type="label">
                    <description>DURATION</description>
                    <height>33</height>
                    <width>500</width>
                    <font>font13</font>
                    <aligny>center</aligny>
                    <align>left</align>
                    <textcolor>FFFF0000</textcolor>
                    <textoffsetx>0</textoffsetx>
                    <textoffsety>0</textoffsety>
                    <label>Param is: $PARAM[sety]</label>
                </control>
            </control>
        </definition>
    </include>

and calling it from View_55_WideList.xml:
Code:
<include content="Test_param">
    <param name="sety">20</param>
 </include>

and as I wrote, running Kodi 18.0 with this I get Param is: $PARAM[sety]

And then deleting the comment like this:
Code:
    <include name="Test_param">
        <param name="sety">100</param>
        <definition>
        <control type="grouplist">
                <posx>800</posx>
                <posy>100</posy>
                <width>500</width>
                <height>1080</height>
                <orientation>vertical</orientation>
                <itemgap>0</itemgap>
                <control type="label">
                    <description>DURATION</description>
                    <height>33</height>
                    <width>500</width>
                    <font>font13</font>
                    <aligny>center</aligny>
                    <align>left</align>
                    <textcolor>FFFF0000</textcolor>
                    <textoffsetx>0</textoffsetx>
                    <textoffsety>0</textoffsety>
                    <label>Param is: $PARAM[sety]</label>
                </control>
            </control>
        </definition>
    </include>

and now I get Param is: 20 as expected.

Any ideas what's going on here?

scott s.
.
Reply
#2
It's a known bug since the introduction of the param feature. I've reported it ~2 years ago, and others too. Sometimes <!-- comment --> is breaking everything, sometimes not.
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
Wow.  thanks for that.  This was my first attempt at using parameters so I assumed I was making mistakes.   I wasted experienced some good testing and just lucked onto it.

scott s.
.
Reply
#4
(2019-02-28, 08:45)sualfred Wrote: It's a known bug since the introduction of the param feature. I've reported it ~2 years ago, and others too. Sometimes <!-- comment --> is breaking everything, sometimes not.
 Good to know this. I have some functions that I wanted to implemenemt with Paramterized Includes and they didnt seem to work, eventhough I had very similar code in other windows. so I just gave up, but I think this here is exactly what was happening, I like to comment my code a  lot. Thanks for the Hint.
Reply
#5
a bit  i unsure ss i didnt call a <definition> tag.
and wrote with my thumb and c/p...

but im fine with params in includes

e.g.
xml:

<include name="test pos" content="test pos" condition="a + !b">
            <param name="size" value="70" />
            <param name="posleft" value="10" />
<param name="itemgap" value="5" /> 
<param name="bottom" value="5" />
<param name="label" value="will/can be variable of condotion if a + !b />
        </include>
        <include name="test pos" content="test pos" condition="a + b">
            <param name="size" value="80" />
            <param name="posleft" value="0" /> 
<param name="itemgap" value="15" /> 
<param name="bottom" value="5" />
<param name="label" value="will/can be variable of condotion if a + b />
        </include>
<include name="test pos" content="test pos" condition="!a + b">
            <param name="size" value="50" />
            <param name="posleft" value="20" /> 
<param name="itemgap" value="20" /> 
<param name="bottom" value="30" /> 
<param name="label" value="will/can be variable of condotion if !a + b />
</include>
</include>
    <include name="test pos">
<control type="grouplist" id="200">
<posx>$PARAM[posleft]</posx>
<bottom>$PARAM[bottom]</bottom>
<height>$PARAM</height>
<itemgap>$PARAM[itemgap]</itemgap>
<label>$PARAM[label]</label>
.
.
.

<include>


Sorry if i did get a wrong understand of the issue?
 (also new to get undetstamding the params)
Skins |  Titan M O D   •   S W A N (WIP)
Reply
#6
(2019-03-02, 00:02)mardukL Wrote: Sorry if i did get a wrong understand of the issue?
 (also new to get undetstamding the params)
Yeah, that's not the issue. The issue is about including <!-- Comments --> near the top of the include will stop params from being passed through correctly.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#7
@scott967 - One work around is to use description tags. I would rather use <!-- comments -->, but at least there is a way to comment your code!

Either:
Code:
<control type="group" description="my description">

Or:
Code:
<control type="group">
<description>my description</description>

Can use description tags in any control type.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#8
Wondering if this happens also when definition tag is NOT used/comment is outside definition scope...?

On a different subject, I've had many issues with $EXP sometimes not parsed by kodi (also logged in debug file), noticed that it was sometimes just parsed as OR operator '|'...
Reply
#9
This issue was fixed in #22234
Reply

Logout Mark Read Team Forum Stats Members Help
Include $PARAM not being evaluated0