[SOLVED] - Coercing an InfoLabel to return an Integer (not a string) - 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: [SOLVED] - Coercing an InfoLabel to return an Integer (not a string) (/showthread.php?tid=375176) |
[SOLVED] - Coercing an InfoLabel to return an Integer (not a string) - DeltaMikeCharlie - 2023-11-27 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"> 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. RE: Coercing an InfoLabel to return an Integer (not a string) - DeltaMikeCharlie - 2023-11-27 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. RE: Coercing an InfoLabel to return an Integer (not a string) - DeltaMikeCharlie - 2023-11-27 Naturally, a bool did not work either. I guess that I'll settle for a string. RE: [SOLVED] - Coercing an InfoLabel to return an Integer (not a string) - DeltaMikeCharlie - 2023-11-29 (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(). |