Kodi Community Forum
Adding a new boolean condition - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: Adding a new boolean condition (/showthread.php?tid=237475)



Adding a new boolean condition - rysport - 2015-09-01

Hi,

I need to add a new boolean property for my work on hiding unavailable library items.

I've successfully hidden items by using the "IsSpecial" FileItem property like this

In Kodi core:
pItem->SetProperty("isspecial", true);

and in the skin xml (ViewVideoLibrary.xml):
<visible>!ListItem.Property(IsSpecial)</visible>

But of course, isspecial is used by other parts of Kodi so I need to move this to another property. Creating the property in Kodi core seems to work with pItem->SetProperty("isavailable", true); But how do I create a corresponding "getter" for the skin, like ListItem.Property(IsAvailable)?


RE: Adding a new boolean condition - ironic_monkey - 2015-09-02

props are just string<->value pairs and the support is general. set a property, and the skin can read it.


RE: Adding a new boolean condition - Montellese - 2015-09-02

My media import work has a similar functionality because it knows which media providers are available and which aren't and therefore knows which items are available and which aren't. I've added an "enabled" property to CFileItem for this and in the skinning engine it can be used with ListItem.IsEnabled. See https://github.com/Montellese/xbmc/commit/7a4151b4b35161bf09afc9c1ea96bd27deff9a38 (but that will soon be outdated as this code is being refactored right now by someone else).


RE: Adding a new boolean condition - rysport - 2015-09-02

(2015-09-02, 09:15)ironic_monkey Wrote: props are just string<->value pairs and the support is general. set a property, and the skin can read it.
Thanks, didn't expect it to be that easy Blush

(2015-09-02, 09:47)Montellese Wrote: My media import work has a similar functionality because it knows which media providers are available and which aren't and therefore knows which items are available and which aren't. I've added an "enabled" property to CFileItem for this and in the skinning engine it can be used with ListItem.IsEnabled. See https://github.com/Montellese/xbmc/commit/7a4151b4b35161bf09afc9c1ea96bd27deff9a38 (but that will soon be outdated as this code is being refactored right now by someone else).

Thanks, I'll check it out.