Kodi Community Forum

Full Version: Infolabel.Is conditional?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Several times in the past, I have encountered situations that could have been resolved or at least significantly eased by the existence of a universal system state conditional that applies to all infolabels. Ahead of time, please forgive me if it isn't possible to implement anything like this without going through it all manually. However, it SEEMS like it should be possible, you just need to find the value of the infolabel name you state, and see whether it matches the value you state. I think this is easiest explained through example.

So, for this example, assume you want to show a certain texture in the skin only when the current weather state is Snow, snow-rain mix, or ice/rain-snow mix (obviously those aren't the correct names but you get the idea). It might go something like this:

<visible>Infolabel.Is(Weather.Conditions(Snow) | Weather.Conditions(Snow-Rain Mix) | Weather.Conditions(Ice/Rain-Snow Mix)</visible>

It seems like this would eliminate the need to separately add conditionals support for all the different system states or infolabels that exist and will exist in the future when people find a use for such and such a boolean.

This secondary part of the idea may not be so simple or possible as the the first part (i don't know), but to extend this further, for infolabels that would be numbers, some sort of less than greater than symbology could be useful, perhaps along the lines of condition(startnumber,endnumber) to specify the boundaries of when that condition would be true, and using the format hh:mmConfuseds for times, and just integer values for non time values, such as number of items in a playlist or whatever. Leaving off the endtime parameter would mean anything equal to or greater than the number entered would come back as true. For less than, of course, you just make it as between 0 and whatever other number.

Another random example. Assume you wanted some sort of notification or image to appear when Videos of over 2 minutes in length had 30 seconds remaining and you weren't in full screen. It could look something like this:

<visible>Player.HasVideo + !VideoPlayer.IsFullscreen + Infolabel.Is(Player.Duration(00:02:00) + (Player.TimeRemaining(00:00:30,00:00:05)</visible>

Perhaps you guys wouldn't allow the connector (ie, +) symbols within the infolabel tag, not sure how you apply all that stuff. Anyway, I'm just trying to make things easier on you guys while expanding options for the skinners. It seems to me (the non-knowledgable's perspective!) that you could add a lot of functionality in one fell swoop while simultaneously avoiding many future feature requests and the need to make changes when such a conditional is deemed worthy.

Thanks for your time, in advance!
on comparing the values of info labels i cant agree more. which is why i had this added a week back.

comparestring(<infolabel>,<value>)

whether or not this works like your examples i really dont know, cant make out what you mean. i mean,

Quote:<visible>Infolabel.Is(Weather.Conditions(Snow) | Weather.Conditions(Snow-Rain Mix) | Weather.Conditions(Ice/Rain-Snow Mix)</visible>

dont even match parantheses correctly...
spiff Wrote:on comparing the values of info labels i cant agree more. which is why i had this added a week back.

comparestring(<infolabel>,<value>)

whether or not this works like your examples i really dont know, cant make out what you mean. i mean,



dont even match parantheses correctly...

Wow, well I have poor timing. I missed that somehow. Thanks for being a step ahead!

And whoops, sorry, I see I left a parenthesis off the end. Like i mentioned in there somewhere, I thought you might not allow for the +,|,! items within the condition like that, but thought maybe it would simplify things a bit if you didn't have to enter than whole long string for each condition (ie, [Infolabel.Is(Weather.Location(Seattle, WA) | Weather.Location(New York, NY)] rather than [Infolabel.Is(Weather.Location(Seattle, WA) | Infolabel.Is(Weather.Location(New York, NY)]...I was probably overthinking it as I tend to do. It may very well be that what i suggested there was a completely impossible syntax, I wouldn't know Sad. Anyway, your way (not surprisingly) is certainly much better and more concise.

Any future plans to allow ranges for the value for numbers, like if you want to match all values between 20 and 40 or whatever? Could be useful for the time and media count related infolabels I would imagine.
parsing things like you wrote them is simply not feasable. it does not follow normal operator logic. in any case that would read
comparestring(weather.location,Seattle, WA) fyi

as for others, sure, we could have comparerange etc. trac it
spiff Wrote:parsing things like you wrote them is simply not feasable. it does not follow normal operator logic. in any case that would read
comparestring(weather.location,Seattle, WA) fyi

as for others, sure, we could have comparerange etc. trac it

Alright, I'm not surprised, my stupidity is half expected. The most advanced coding ive done is xml, I know nothing about the background code that supports the xml. And right, i understand the logic of what you added I was just trying to explain my previous (flawed) logic. Smile And, will do.