Trying to fill Home Container with dynamic Data
#1
Hello all. I am trying to fill a container with dynamic data. I've read through all https://kodi.wiki/view/Skinning and Add-on Development for days but i can't find the solution. I've also read through this very old Thread: https://forum.kodi.tv/showthread.php?tid=176864&page=11 named "HEADS UP: Filling a list from a directory/plugin".
This is how far i came up to now:
Inserted a new "Menu Point" in Home.xml to <control type="fixedlist" id="9000"> and added a new <control type="group" id="31000"> section to it with a list: <control type="list" id="52">.
This list with ID 52 is filled by a plugin that i wrote via <content target="videos" limit="20">plugin://plugin.video.mybox/</content>.
This works. This works very well, i can see all my content Wink The problem is, it is only filled once at Kodi startup when the Home.xml is rendered. And so i searched for days for a solution to periodically/dynamically update it.

So the simple question is, what is the best/normal way to update such a Container/List?

What i tried so far:
Extending my Plugin with point="xbmc.service" that runs in background and updates the data. The service works well, gets the data from the API, but i tried two ways to update that List with ID 52, both failed:

First i tried to set properties with xbmcgui.Window(10000).setProperty(....) because i found an other old post: https://forum.kodi.tv/showthread.php?tid...ight=panel.
Here, in the XML File the content is included via these "environment" variables that you set with setProperty to a Window. He is using:

Code:
        <content>
            <item id="11">
                <label>$INFO[Window.Property(RecommendedAlbum.1.Title)]</label>
to bind these "environment" variables with a count. Thats great, i just don't know if my <itemlayout> has only 2 pictures with <texture> tags how to address them:

Code:
<itemlayout height="220" width="500">
<control type="image">
...
<texture>[HOW to address this field with $INFO ?]</texture>
/control>
<control type="image">
...
<texture>[HOW to address this field with $INFO ?]</texture>
/control>

The other thing i tried is to use the Service to edit the List with ID 52 and xbmcgui:

Code:
list_control = xbmcgui.Window(10000).getControl(52)
list_control.removeItem(0)

Trying to edit (delete first item) from the Home.xml List. But Kodi crashes trying to do this.
Would it be possible if i used xbmcgui.addControl() to add the List instead of using the Home.xml to create the List that was filled by <content>PluginUrl</content> before?

If anyone could help me out, i would be very thankful Wink Thanks for any hint or direction to go. I've just started developing Kodi Addons.
Reply
#2
I think i have found a solution that should work, by using "property" together with the <texture> tag.

Anyone can tell me why this won't work:

Code:
    <control type="group" id="25000">
        <visible>String.IsEqual(Container(9000).ListItem.Property(id),myhomelist)</visible>
        <include content="WidgetListCommon">
            <param name="list_id" value="$PARAM[list_id]"/>
        </include>
        <control type="label">
            <left>600</left>
            <top>80</top>
            <width>900</width>
            <height>90</height>
            <label>MyHomeList</label>
            <shadowcolor>text_shadow</shadowcolor>
        </control>
        <control type="list" id="53">
            <left>600</left>
            <top>130</top>
            <width>100%</width>
            <height>100%</height>
            <!--<onleft>9000</onleft>
            <onright>31010</onright>-->
            <onup>52</onup>
            <ondown>52</ondown>
            <!--<scrolltime tween="cubic" easing="out">500</scrolltime>-->
            <orientation>vertical</orientation>
            <pagecontrol>31010</pagecontrol>
            <itemgap>10</itemgap>
            <itemlayout height="220" width="500">
                <control type="group">
                <control type="image">
                    <left>0</left>
                    <top>10</top>
                    <width>200</width>
                    <height>200</height>
                    <background>True</background>
                    <texture>$INFO[Window(Home).Property(Texture1)]</texture>
                </control>
                <control type="label">
                    <left>300</left>
                    <top>100</top>
                    <width>100</width>
                    <height>200</height>
                    <textcolor>FFB2D4F5</textcolor>
                    <shadowcolor>ff000000</shadowcolor>
                    <font>font13</font>
                    <selectedcolor>green</selectedcolor>
                    <align>center</align>
                    <label>$INFO[Window(Home).Property(LabelValue)]</label>
                </control>
                <control type="image">
                    <left>450</left>
                    <top>10</top>
                    <width>200</width>
                    <height>200</height>
                    <background>True</background>
                    <texture>$INFO[Window(Home).Property(Texture2)]</texture>
                </control>
                </control>
            </itemlayout>
            <focusedlayout height="220" width="500">
                <control type="group">
                        <!--<depth>DepthContentPopout</depth>
                        <top>10</top>-->
                        <animation effect="zoom" start="100" end="105" time="100" tween="linear" easing="inout" center="0,0">Focus</animation>
                        <animation effect="zoom" start="105" end="100" time="100" tween="linear" easing="inout" center="0,0">UnFocus</animation>
                <control type="image">
                    <left>10</left>
                    <top>10</top>
                    <width>200</width>
                    <height>200</height>
                    <texture>$INFO[Window(Home).Property(Texture1)]</texture>
                </control>
                <control type="label">
                    <left>250</left>
                    <top>100</top>
                    <width>70</width>
                    <height>200</height>
                    <font>font13</font>
                    <selectedcolor>green</selectedcolor>
                    <align>center</align>
                    <label>$INFO[Window(Home).Property(LabelValue)]</label>
                </control>
                <control type="image">
                    <left>300</left>
                    <top>10</top>
                    <width>200</width>
                    <height>200</height>
                    <texture>$INFO[Window(Home).Property(Texture2)]</texture>
                </control>
                </control>
            </focusedlayout>
            <content>
            <item>
                <texture property="Texture1">$INFO[Window(Home).Property(myhome.1.Image1)]</texture>
                <texture property="Texture2">$INFO[Window(Home).Property(myhome.1.Image2)]</texture>
                <label property="LabelValue">Blah</label>
                <thumb>$INFO[Window(Home).Property(myhome.1.Image1)]</thumb>
                <visible>True</visible>
            </item>
            </content>
    </control>
    <include content="WidgetScrollbar" condition="Skin.HasSetting(touchmode)">
        <param name="scrollbar_id" value="31010"/>
    </include>
</control>

The Service sets the Property like this:

Code:
xbmcgui.Window(10000).setProperty("myhome.%d.Image1"           % (count), Image1)
xbmcgui.Window(10000).setProperty("myhome.%d.Image2"           % (count), Image2)
where Image1 is python var with a http-Link.

I am close to desperation, thanks for any hint Wink
Reply
#3
That doesn't look right at all?

I think you want something like
xml:

<control type="list" id="53">
    <itemlayout>
        <control type="label">
            <label>ListItem.Property(LabelValue)</label>
        </control>
        <control type="image">
            <texture>ListItem.Property(Texture1)</texture>
        </control>
    </itemlayout>
    <content>
        <item id="1">
            <label>some label</label>
            <property name="LabelValue">blah</property>
            <property name="Texture1">$INFO[Window(Home).Property(myhome.1.Image1)]</property>
        </item>
    </content>
</control>

scott s.
.
Reply
#4
I think again i found the fault myself, sorry for flooding Wink Just not that anyone looks it up or it may help somebody else: You have to use it like that:

Code:
    <content>
        <item>
            <property name="Texture1">$INFO[Window(10000).Property(myhome.1.Image1)]</property>
            <property name="Texture2">$INFO[Window(10000).Property(myhome.1.Image1)]</property>
            <property name="LabelValue">Blah</property>
        </item>
    </content>

That works, question is now if it updates when the Service changes myhome.1.Image1....
Reply
#5
Thanks a lot scott! Thats exactly what i was looking for and it works!
Do you know if the Service changes the values, if it will be updated in the Kodi "Menu Point"?
Reply
#6
It does update, just tested, that seems to be the solution if you want dynamic data in your Home.
Thanks to Kodi and everyone that contributes to the still best open source project out there.
Reply

Logout Mark Read Team Forum Stats Members Help
Trying to fill Home Container with dynamic Data0