Req String parse and round
#1
Firstly, due to the following, rating display in many parts of Estouchy is broken.

With the removal of ListItem.StarRating, we no longer have a convenient means of displaying an image form of rating for various items. We could add StarRating back (which I imagine would get kickback, as I imagine there was a debate on whether to remove it in the first place), but I think a more reasonable request would be a String.RoundInteger(string number) function for skinners. It takes a string representation of a float, rounds it, and gives an integer (string representation or not). With this, we can have simple star ratings back via
Code:
<texture fallback="rating/0.png">rating/String.RoundInteger($INFO[ListItem.Rating]).png</texture>
The format is up to devs as I admit it looks stupid like that, and it would likely affect parsability due to recursion of evaluation and/or parsing parenthesis.

Let me know what you think.
Developer for Shoko and Nakamori. Long time user of Kodi, before it was even called Kodi. My XBOX died long ago, but Windows is still just as broken and necessary. I obviously watch anime, given my first comment. Video games, manga, music, you name it.
Reply
#2
You can achieve what you want with a variable I think (Kodi 17)...

Code:
<value condition="Integer.IsLess(ListItem.Rating,1)">rating0.png</value>
<value condition="Integer.IsLessOrEqual(ListItem.Rating,2)">rating1.png</value>
<value condition="Integer.IsLessOrEqual(ListItem.Rating,4)">rating2.png</value>
<value condition="Integer.IsLessOrEqual(ListItem.Rating,6)">rating3.png</value>
<value condition="Integer.IsLessOrEqual(ListItem.Rating,8)">rating4.png</value>
<value condition="Integer.IsLessOrEqual(ListItem.Rating,10)">rating5.png</value>
Reply
#3
I'll try it. If it works, then it's messy, and it works.... it would be nice to have a round function, anyway, though.
Developer for Shoko and Nakamori. Long time user of Kodi, before it was even called Kodi. My XBOX died long ago, but Windows is still just as broken and necessary. I obviously watch anime, given my first comment. Video games, manga, music, you name it.
Reply
#4
Cool. It works, but it does not round. At least assuming Integer.IsLess only takes integers as a second argument, then it can't be written to round as you can't multiply by 10 or handle halves.
I suppose going from there, it would be far more useful to add the following:
Float.IsLess
Float.IsLessOrEqual
Float.IsGreater
Float.IsGreaterOrEqual
Float.IsEqual

Float.Add
Float.Subtract
Float.Multiply
Float.Divide

From there, you could do almost anything, even if it takes way too many steps.
Developer for Shoko and Nakamori. Long time user of Kodi, before it was even called Kodi. My XBOX died long ago, but Windows is still just as broken and necessary. I obviously watch anime, given my first comment. Video games, manga, music, you name it.
Reply

Logout Mark Read Team Forum Stats Members Help
String parse and round0