Kodi Community Forum
Boolean conditions from extensions - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Boolean conditions from extensions (/showthread.php?tid=364587)



Boolean conditions from extensions - DanTheMan827 - 2021-09-22

Allowing extensions to provide boolean conditions could be useful for context menu extensions.

Example: The extras extension always shows the extras menu even if none are present.


RE: Boolean conditions from extensions - pkscout - 2021-09-23

Add-ons that provide context menus can already use boolean conditions.  In fact, here's the boolean expression to ensure Extras only shows up on movies, tv shows, and seasons:

xml:

        <visible>String.IsEqual(ListItem.dbtype,movie)
            | String.IsEqual(ListItem.dbtype,tvshow)
            | String.IsEqual(ListItem.dbtype,season)
        </visible>

What you want is for the context menus to adapt based on the thing selected.  More actually. You want the context menu to adapt based on files in a directory based on the thing selected.  You can't do that from the addon.xml file (which is where the context menus are defined).  You'd need to have some kind of service add-on that constantly scans all your sources for the directory structure so it can set some skin variables, which can then be used in the addon.xml.

Which is why you got the response you did in the Extras thread saying Extras would have to be completely rewritten to only show the context item if there are items in the folder.