Kodi Community Forum

Full Version: 2 Dimensional List
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I was wonder if it was possible either through XML or python to create a list container that contains another list. Basically, I would like to create a skin/script that will display a vertical list of movie genres, and under each genre a horizontal list of movies in that genre. (Similar to how Roku displays netflix movies)

If there is not support for a list inside of a list. Is there a possible workaround?

Thank you for the help,
Ryan
You could use a grouplist filled with groups for each genre containing a label (the genre) and a container (list, wraplist, etc) with dynamic content pointing to a smart playlist. You may be able to point the content to the genre path (videodb://movies/genre/[id]) but then you need to know the id number for each genre.

Perhaps someone else could think of a easier way. Might be able to get you started though.
I think the 2D-list should be doable, but the question is how you will supply content for each genre sub-list.
For this you will need to think about a script or use preconfigured smartplaylists - assuming the genre list is static.
I was planning on using a script as well to grab all the possible Genres and each movie as well. I have a python dictionary defied with the genre as the key and the videos as the elements. I think where I am running into trouble is the XML code for the layout. Is it valid to have a list control and then another list under the itemlayout? For example:

Code:
<control type="list" id=101>
    <description>Genre List Container</description>
    <left>0</left>
    <top>20</top>
    <width>1280</width>
    <height>380</height>
    <visible>true</visible>
    <viewtype>list</viewtype>
    <orientation>vertical</orientation>
    <pagecontrol>25</pagecontrol>
    <scrolltime tween="sine" easing="out">200</scrolltime>
    <autoscroll>false</autoscroll>
    <itemlayout width="1240" height="172">
        <control type="list" id=102>
            <description>Video List Container</description>
            <left>0</left>
            <top>35</top>
            <width>1240</width>
            <height>172</height>
            <visible>true</visible>
            <viewtype>list</viewtype>
            <orientation>horizontal</orientation>
            <pagecontrol>25</pagecontrol>
            <scrolltime tween="sine" easing="out">200</scrolltime>
            <autoscroll>false</autoscroll>
            <itemlayout width="100" height="172">
                <control type="label">
                    <left>0</left>
                    <top>0</top>
                    <width>100</width>
                    <height>172</height>
                    <font>font14</font>
                    <selectedcolor>green</selectedcolor>
                    <label>$INFO[ListItem.Label2]</label>
                </control>
            </itemlayout>
            <focusedlayout width="100" height="172">
            ....
        </control>
    </itemlayout>
    ....
</control>

I was assuming that a list container can only hold labels and images.

The idea of a grouplist for genres would work, but the genres aren't static so I don't really know how many genre's there will be.

Thank you,
Ryan
You would do something like this (I'm using pseudo-code here but it should be easy enough to adapt to your purpose):

Code:
<control type="grouplist">
    <...>
    <orientation>vertical</orientation>
    
    <!--Genre 1-->
    <control type="group" id="1000">
        <...>
        <visible>IntegerGreaterThan($INFO[Container([id of the list below]).NumItems)],0)</visible> <!--This will hide the group if the genre container doesn't have any movies in it.-->
        <control type="label" id="1100">
            <...>
        </control>
        <control type="list" id="1200"> <!--This is the container that will hold of the movies that have this genre-->
            <onup>[previous list id]</onup>
            <ondown>[next list id]</ondown>
            <onright>1200</onright>
            <onright>1200</onright>
            <itemlayout>
                <...>
            </itemlayout>
            <focusedlayout>
                <...>
            </focusedlayout>
            <content type="video">plugin://[this is where you grab the dynamic content supplied by your script</content>
        </control>
    </control>

    <!--Rinse and repeat the above group for as many genres you think you might need-->
</control>
What you are trying to implement is actually veryeasy.

you need to use the dynamic list content capabilty of the skin engine

Aadd a new list to the movie genres window and have the new list be filled with the following content tag

<content>$INFO[ListItem.DBID,videodb://movies/genres/,]</content>