Kodi Community Forum

Full Version: SetProperty issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here is my list I used in my custom Skin.
xml:

@ViewsViewTypeList.xml
<include name="View_903_View">
    <control type="list" id="903">
        <left>176</left>
        <top>60</top>
        <width>1692</width>
        <height>1000</height>
                //...SKIP
        <itemlayout height="240" width="180">
            <control type="label">
                <font>primal_13</font>
                <label fallback="N/A">$INFO[ListItem.Property(Cast.1.Name)]</label>
                       //...SKIP                        
                    </control>
            <control type="label">
                <font>primal_13</font>
                <label fallback="N/A">$INFO[Window(home).Property(test)]</label>
                        ...SKIP
                    </control>
        </itemlayout>
        <focusedlayout height="240" width="180">
            <control type="group">
                <control type="button">
                    <visible allowhiddenfocus="true">false</visible>
                    <onfocus>SetProperty(test,$INFO[ListItem.Property(Cast.1.Name)],home)</onfocus>
                </control>
            </control>
        </focusedlayout>
        <content>$VAR[TMDBCast]</content>
    </control>
</include>

$VAR[TMDBCast] is defined as below @Variables.xml
<variable name="TMDBCast">
    <value>plugin://plugin.video.themoviedb.helper/?info=details&type=movie&query=$INFO[ListItem.Title]</value>
</variable>

@IncludesViewTypeList.xml
<include name="ViewsVideo">
    <control type="group" id="777">
        <visible>!Window.IsVisible(selectdialog)</visible>
        <include>View_55_FileMode</include>
        //This one
        <include>View_903_View</include>
        //Above one
        <include>View_900_POSTER</include>
        <include>View_902_POSTER</include>
        <include>View_901_Ep_View</include>
        <include>View_88_FileModeforvideoaddon</include>
        <include>View_1000_VideoAddon</include>
    </control>
</include>
@MyVideoNav.xml
<include>ViewsVideo</include>

I am trying to get selected movie actor name via plugin.video.themoviedb.helper.
For plugin.video.themoviedb.helper. just follows wiki as it is
https://github.com/jurialmunkey/plugin.v...ailed-Item

WORKS (I CAN SEE 1 st Actor name in my SKIN)
 <label fallback="N/A">$INFO[ListItem.Property(Cast.1.Name)]</label>
DID'N WORK (Just show fallback "N/A")
<label fallback="N/A">$INFO[Window(home).Property(test)]</label>

To run script I use hidden button as below (I am sure works, i.e it works $INFO[ListItem.Property(Cast.1.Name)] )
xml:

<control type="button">
    <visible allowhiddenfocus="true">false</visible>
    <onfocus>SetProperty(test,$INFO[ListItem.Property(Cast.1.Name)],home)</onfocus>
</control>        

However, I can not get $INFO[Window(home).Property(test)] on my skin.

I tried a different window id as below, but it also does not work - can not display $INFO[] information.
https://kodi.wiki/view/Window_IDs
videos/ WINDOW_VIDEO_NAV/ 10025 / MyVideoNav.xml
xml:

<control type="button">
    <visible allowhiddenfocus="true">false</visible>
    <onfocus>SetProperty(test,$INFO[ListItem.Property(Cast.1.Name)],10025)</onfocus>
</control>

<control type="label">
    <label fallback="N/A">$INFO[Window(10025).Property(test)]</label>
</control>

I suspect there is something wrong SetProperty
SetProperty(test,$INFO[ListItem.Property(Cast.1.Name)],home)
or
SetProperty(test,$INFO[ListItem.Property(Cast.1.Name)],10025)

Can Someone help me with what I am missing?
I don't fully understand skinning yet, but I think maybe this boills down to a timing issue and order of processing for the skin.

I asked ChatGPT about your code examples (and had to further explain the issue), and it reponed with:
----------------------------
Thank you for clarifying the issue. It seems that the test property is not being set correctly when the onfocus event is triggered.
One possible reason for this could be that the home context is not available in the list view where the onfocus event is defined.

----------------------------

I think this makes sense, "home" is not allowed within the list_view section. And since my translation addon only sets properties for the home window, I am not sure how to get around this for your use case, but maybe other would?

And if there is a workaround/alteration for my addon to make the translated text available in a different way, I am willing to look into that.

Hope this helps a bit.
Some thoughts:

1) Is this a view or just a list? If it's a view, it should be capable of taking dynamic content, i.e. to show movies, tvshows, seasons, episodes etc. In that case, you need to add ID of the list to <views> in MyVideoNav.xml. Otherwise the view won't be enabled and you won't be able to select it when you scroll through your views.

2) Judging by the content path, this list is a secondary list that you wish to use to display content based on an item selected in your primary list. ie. to get cast info for the selected Movie. Is this correct?

If so, I don't think your approach wouldn't work unless you're giving the list focus. Because of the list doesn't have focus, the button will never fire and the property won't be set.

3) Are you trying to use the window property in the. focusedlayout to set the label in the itemlayout? That would end up with the labels for every item in your list being the same.

6) @jurialmunkey can correct me if I'm wrong, but I think to do what you're trying to do you would need to use the TMDB helper pluginsource to populate a hidden list and then use a grouplist or a textbox to actually display the information you want.

xml:

<control type="list" id="903">
    <itemlayout />
    <focusedlayout />
    <content>>plugin://plugin.video.themoviedb.helper/?info=details&type=movie&query=$INFO[ListItem.Title]</content>
</control>

<control type="grouplist" id="904">
    <left>176</left>
    <top>60</top>
    <width>1692</width>
    <orientation>vertical</orientation>
    <control type="button" id="1">
        <label>$INFO[Container(903).ListItem.Property(Cast.0.Name)]</label>
    </control>
    <control type="button" id="2">
        <label>$INFO[Container(903).ListItem.Property(Cast.1.Name)]</label>
    </control>
    <control type="button" id="3">
        <label>$INFO[Container(903).ListItem.Property(Cast.2.Name)]</label>
    </control>
   ...
</control>

I used buttons in the grouplist so you can navigate through the list if you are giving it focous, if that's not required, you could just use labels and have an autoscroll or potentially just a textbox with an autoscroll and the rows separated like so: $INFO[Container(903).ListItem.Property(Cast.0.Name)][CR]$INFO[Container(903).ListItem.Property(Cast.1.Name)][CR]$INFO[Container(903).ListItem.Property(Cast.2.Name)]



5) Aside from the button your focusedlayout is empty.
The reason is simple:

Inside itemlayout, Kodi will only read $INFO[] *once* when it creates the item onscreen.

That is, all properties available inside itemlayout are frozen at the point the item appeared. The only time Kodi refreshes the $INFO[] values for onscreen items in itemlayout is when the whole list gains or loses focus, or when the item itself gains focus.

You can see this in action by putting $INFO[System.Time(ss)] into a label inside a list container and you will notice that it never updates except for new items appearing on screen; or when the item is focused; or when the whole list loses focus.

The reason is for performance to avoid each item constantly reading metadata.
@realcopacetic 
Thank you for the information.
your code, it works my skin as well - $INFO[Container(903).ListItem.Property(Cast.0.Name)] from plugin://plugin.video.themoviedb.helper/?info=details&type=movie&query=$INFO[ListItem.Title]
My issue is NOT "$INFO[Container(903).ListItem.Property(Cast.2.Name)]" from "<content>>plugin://plugin.video.themoviedb.helper/?info=details&type=movie&query=$INFO[ListItem.Title]</content>"
My issue is not get any label information "<label fallback="N/A">$INFO[Window(home).Property(test)]</label>" from "SetProperty(test,$INFO[ListItem.Property(Cast.1.Name)],home)"

Here is an answer to your question
1) Is this a view or just a list?
view(Movies), also include my view list id on MyVideoNav.xml.

2) Judging by the content path, this list is a secondary list that you wish to use to display content based on an item selected in your primary list. ie. to get cast info for the selected Movie. Is this correct?
Yes. correct.
One list is show movie label, year, director..etc..EXCEPT actor name. (I need actor name only from plugin.video.themoviedb.helper which selected the movie library list)
The second is suppose to get the movie actor's name from plugin.video.themoviedb.helper

3) Are you trying to use the window property in the. focusedlayout to set the label in the itemlayout? That would end up with the labels for every item in your list being the same.
I already did it. Again I have no problem getting actor's name thru $INFO[Container(903).ListItem.Property(Cast.2.Name)]

6) Again it also works for my skin.
@jurialmunkey 
So, do you have any idea to set "SetProperty(test,$INFO[ListItem.Property(Cast.1.Name)],home)" in the list?
It would be very helpful to modify my original XML code from you.
(2023-03-09, 10:21)kenmoon Wrote: [ -> ]@realcopacetic 
Thank you for the information.
your code, it works my skin as well - $INFO[Container(903).ListItem.Property(Cast.0.Name)] from plugin://plugin.video.themoviedb.helper/?info=details&type=movie&query=$INFO[ListItem.Title]
My issue is NOT "$INFO[Container(903).ListItem.Property(Cast.2.Name)]" from "<content>>plugin://plugin.video.themoviedb.helper/?info=details&type=movie&query=$INFO[ListItem.Title]</content>"
My issue is not get any label information "<label fallback="N/A">$INFO[Window(home).Property(test)]</label>" from "SetProperty(test,$INFO[ListItem.Property(Cast.1.Name)],home)"

Here is an answer to your question
1) Is this a view or just a list?
view(Movies), also include my view list id on MyVideoNav.xml.

2) Judging by the content path, this list is a secondary list that you wish to use to display content based on an item selected in your primary list. ie. to get cast info for the selected Movie. Is this correct?
Yes. correct.
One list is show movie label, year, director..etc..EXCEPT actor name. (I need actor name only from plugin.video.themoviedb.helper which selected the movie library list)
The second is suppose to get the movie actor's name from plugin.video.themoviedb.helper

3) Are you trying to use the window property in the. focusedlayout to set the label in the itemlayout? That would end up with the labels for every item in your list being the same.
I already did it. Again I have no problem getting actor's name thru $INFO[Container(903).ListItem.Property(Cast.2.Name)]

6) Again it also works for my skin.

Unless I misunderstand you, you don't need to create a new view to do what you're doing, which is to add a secondary list to an existing view. But that's just semantics of what you're calling it in your includes, it shouldn't make a functional difference whether we consider this a view or a list.
But if you're not giving your list id "903" focus, it will never be able to set the property, because the hidden button will never have focus. That's why I suggested it's better just to have the list id "903" empty and hidden, so it updates each time you scroll to a new item in your primary list. And then you just update a grouplist/textbox/label with $INFO[Container(903).ListItem.Property(Cast.2.Name)].

I still don't understand what you're trying to achieve by using a window property, sorry.
@realcopacetic 
This issue was started in this thread,
https://forum.kodi.tv/showthread.php?tid...pid3143624

script.LibreTranslate, you can use the 
RunScript(script.LibraTranslate,q='$ESCINFO[ListItem.Property(Cast.1.Name)]',property=a)
to use LibraTranslate.

But as the comment says
<label>$INFO[Window(home).Property(test)]</label>
<label fallback="..">$INFO[Window(Home).Property(LibraTranslate_a)]</label> )
This part doesn't work for me.
So for that reason 

SetProperty(test,$INFO[ListItem.Property(Cast.1.Name)],home)
is what I'm testing for.
The other thread that @kenmoon  referenced is an addon I made to do translations on the fly.

Since he was having issues getting this to work in his skin code, I recommended that he try first with static data, not using the addon to see if the changes in his skin can hanlde static data first, which is why he is using this kind of setup to test (from above):

<control type="button">
<visible allowhiddenfocus="true">false</visible>
<onfocus>SetProperty(test,$INFO[ListItem.Property(Cast.1.Name)],10025)</onfocus>
</control>

<control type="label">
<label fallback="N/A">$INFO[Window(10025).Property(test)]</label>
</control>

Eventually, when figure out how to do this, he wants to modify the "<onfocus>SetProperty(test,$INFO[ListItem.Property(Cast.1.Name)],10025)</onfocus>" line to instaed "runscript" my addon, which in turn sets such a property (tied to "home" in my code), which maybe I need to change, but that is a detail to work out after he can get a simple test working).

I just don't know enough about skinning to be able to help in getting the simpler test code working for him.
(2023-03-09, 10:23)kenmoon Wrote: [ -> ]@jurialmunkey 
So, do you have any idea to set "SetProperty(test,$INFO[ListItem.Property(Cast.1.Name)],home)" in the list?
It would be very helpful to modify my original XML code from you.
You simply cannot from inside the list. You will have issues with the value being outdated both when setting and getting the property.

The only way to ensure updated values is to both retrieve and use the values outside the list.

You can retrieve the value of a specific container and item position externally in a number of ways (where id is container id and x is position)

Relative position to focused item:
Container(id).listitem(x).property()
Container(id).listitemnowrap(x).property()

Absolute position in list:
Container(id).listitemabsolute(x).property()

Position onscreen:
Container(id).listitemposition(x).property()
@jurialmunkey

Here is my test

<control type="list" id="903"> -> It shows my movie poster from Library (working)
<control type="list" id="9033"> -> It retrieves the actor name from plugin.video.themoviedb.helper,$INFO[Container(9033).ListItem.Property(Cast.1.Name) (working, I can see actor name in skin)
xml:

<control type="list" id="903">
    <itemlayout height="240" width="180">
        <control type="label">
            <label fallback="TEST2">$INFO[Container(9033).listitem(1).property()]</label>
        </control>
        <control type="image">
            <left>-1</left>
            <top>0</top>
            <width>160</width>
            <height>240</height>
            <texture background="true">$INFO[ListItem.Art(poster)]</texture>
            <bordertexture border="10">ThumbShadow.png</bordertexture>
            <bordersize>6</bordersize>
            <aspectratio align="center" aligny="top">stretch</aspectratio>
        </control>
        <focusedlayout height="240" width="180">
            <control type="image">
                <left>-1</left>
                <top>0</top>
                <width>160</width>
                <height>240</height>
                <texture background="true">$INFO[ListItem.Art(poster)]</texture>
                <bordertexture border="10">ThumbShadow.png</bordertexture>
                <bordersize>6</bordersize>
                <aspectratio align="center" aligny="top">stretch</aspectratio>
            </control>
        </focusedlayout>
    </control>

<control type="list" id="9033">
    <itemlayout height="240" width="180">
        <control type="label">
            <left>50</left>
            <top>200</top>
            <width>300</width>
            <height>36</height>
            <font>primal_13_Bold</font>
            <textcolor>$VAR[ColorFontNormal]</textcolor>
            <shadowcolor>$VAR[ColorFontShadow]</shadowcolor>
            <selectedcolor>$VAR[ColorFontSelected]</selectedcolor>
            <align>justify</align>
            <aligny>center</aligny>
            <label fallback="TEST1">$INFO[Container(9033).ListItem.Property(Cast.1.Name)]</label>
        </control>
        <focusedlayout height="240" width="180">
            <control type="label">
                <left>100</left>
                <top>100</top>
                <width>150</width>
                <height>36</height>
                <font>primal_13_Bold</font>
                <textcolor>$VAR[ColorFontNormal]</textcolor>
                <shadowcolor>$VAR[ColorFontShadow]</shadowcolor>
                <selectedcolor>$VAR[ColorFontSelected]</selectedcolor>
                <align>justify</align>
                <aligny>center</aligny>
                <label fallback="TEST1">$INFO[Container(9033).ListItem.Property(Cast.1.Name)]</label>
            </control>
        </focusedlayout>
        <content>plugin://plugin.video.themoviedb.helper/?info=details&type=movie&query=$INFO[ListItem.Title]</content>
    </control>

in 903 list, I put the code
<label fallback="TEST2">$INFO[Container(9033).listitem(1).property()]</label> -> It does not working. Does it correct one? Where do I put "Cast.1.Name"? Does it "$INFO[Container(9033).listitem(1).property(Cast.1.Name)]"? I tried but it is not working too.
You cannot do what you want inside itemlayout/focusedlayout. I have already explained why.