Solved plugin folder listitems don't show $INFO[ListItem.Label2]
#1
I think I understand the problem, but looking for confirmation.

What I have is a plugin that in typical fashion first creates a set of xbmcgui.Listitem(mylabel1,mylabel2) that are added as folder items xbmcplugin.addDirectoryItem(... , listitem, isFolder=True).  Have also tried xbmcgui.Listitem().setLabel2(mylabel2).

In Kodi $INFO[ListItem.Label2] is empty.

I think that is because my sort method xbmcplugin.addSortMethod(handle, SORT_METHOD_NONE, labelMask, label2Mask) there isn't any defined label2Mask for the listitem.getLabel2() in the labelformatter.

It looks to me there needs to be an additional mask like "%g" that would return the item's label2.  I did try setting both labelMask and label2Mask to "%L" and as expected both $INFO[ListItem.Label] and $INFO[ListItem.Label2] returned the item's label.  I don't think folder listitems have any associated infotag? so I don't see any other info or property to set that I could use explicitly instead of $INFO[ListItem.Label2], not that I want to as that would require more complex skin layout coding.

scott s.
.
Reply
#2
OK so I PRed PR#25978 an update to the label formater.
Now you can add a "label2" info to your ListItem and you can set the $INFO[listItem.Label2] to this value by using a new format code "%h" in your call to xbmcplugin.addSortMethod().

For example say you have some folders for movie genres that you create listitems from. The listitem could be created with
Code:
li = xbmcgui.ListItem("drama", num_items)
where num_items is a string variable. Then after adding to your directory with isFolder=True you can add some sort methods
Code:
xbmcplugin.addSortMethod(handle, xbmcplugin.SORT_METHOD_LABEL, labelMask="%L", label2Mask="%h")
to display it, though of course the skin must use $INFO[listitem.label] and $INFO[listitem.label2] in the <itemlayout> - <focusedlayout> for your container content type.

scott s.
.
Reply

Logout Mark Read Team Forum Stats Members Help
plugin folder listitems don't show $INFO[ListItem.Label2]0