[SOLVED] - Coercing an InfoLabel to return an Integer (not a string)
#1
I’m stuck.  I am trying to add an InfoLabel to the System category that returns an integer and I need some help.

I am able to extract all of the data that I need from Kodi, that is not the problem.  My problem is that I am only able to return this value as a string, never an integer.  I would prefer an integer because it will make skin conditional testing easier.

Code:
<variable name="MyNewVariable">
          <value condition="Integer.IsGreater(System.MyNewInteger,1)">$INFO[BlaBla.MyNewString]</value>
</variable>

I could chain together a couple of ‘!String.IsEqual(System.MyNewLabel,X)’ statements in the condition and keep it as a string, but that just seems wasteful and inelegant.

I put a logger entry in the CSystemGUIInfo::GetInt() method and it only ever seems to get called for ‘container’ category items, not ‘system’ category items.

Looking at the InfoLabel documentation, the ‘System’ category does not return any integer properties, only ‘string’ and ‘boolean’.

At some point during the InfoLabel extract and display process, some method somewhere needs to determine whether to call CSystemGUIInfo::GetLabel() or CSystemGUIInfo::GetInt() or CSystemGUIInfo::GetBool() for a particular item.  It’s probably in some parent class somewhere but I am having problems locating that place.

Any help and/or guidance would be appreciated.
Reply
#2
I was too focussed on returning an integer that I overlooked the obvious alternative:  Compare the integer in Kodi and return a boolean to the skin.
Reply
#3
Naturally, a bool did not work either.  I guess that I'll settle for a string.
Reply
#4
(2023-11-27, 09:47)DeltaMikeCharlie Wrote: At some point during the InfoLabel extract and display process, some method somewhere needs to determine whether to call CSystemGUIInfo::GetLabel() or CSystemGUIInfo::GetInt() or CSystemGUIInfo::GetBool() for a particular item.

In hindsight, the solution was so obvious:  The data type returned is dependent upon the context in which it was requested within the skin.

$INFO[System.MyNewLabel] returns a string using CSystemGUIInfo::GetLabel().
<value condition="Integer.IsGreater(System.MyNewLabel,1)"> returns an integer using CSystemGUIInfo::GetInt().
Reply

Logout Mark Read Team Forum Stats Members Help
[SOLVED] - Coercing an InfoLabel to return an Integer (not a string)0