Kodi Community Forum

Full Version: IsEmpty(ListItem.StarRating) never true
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
To hide the star rating even if there's no rating available I have to use this -

PHP Code:
<visible>StringCompare(ListItem.StarRating,rating0.png) | StringCompare(ListItem.StarRating,rating1.png) | StringCompare(ListItem.StarRating,rating2.png) | StringCompare(ListItem.StarRating,rating3.png) | StringCompare(ListItem.StarRating,rating4.png) | StringCompare(ListItem.StarRating,rating5.png)</visible

instead of this -

PHP Code:
<visible>!IsEmpty(ListItem.StarRating)</visible

Surely that should work?
The missing slash closing the visible tag is a typo ?
Yes, corrected my post. Thanks.
AFAIK that was not working. I use IsEmpty(ListItem.Rating) if i want to hide empty ratings (star or numbers).

Cheers
Nessus
Not sure how to actually fix it, but here is something at least a bit more compact:

Code:
<visible>!SubString(Listitem.StarRating, rating)</visible>
That should be -

PHP Code:
<visible>SubString(Listitem.StarRating,rating)</visible

I did try that but for some unknown reason even that doesn't work.
(2014-04-23, 21:19)Hitcher Wrote: [ -> ]That should be -

PHP Code:
<visible>SubString(Listitem.StarRating,rating)</visible

I did try that but for some unknown reason even that doesn't work.

Won't work as it looks like

<label>$INFO[ListItem.StarRating]</label>

is an empty string.
According to wiki it should return 0-5.

Quote:ListItem.StarRating

Returns a value of 0 to 5 as a graphical display from images named rating0.png to rating5.png of the skin
!IsEmpty(ListItem.StarRating) does work on the parent folder item.

EDIT: nvm that last part

EDIT2: okay on album level it doesnt return rating0.png if there's no rating and on song level it does. I knew there was a reason why i use fallback="rating0.png"
(2014-04-24, 14:05)Hitcher Wrote: [ -> ]According to wiki it should return 0-5.

Quote:ListItem.StarRating

Returns a value of 0 to 5 as a graphical display from images named rating0.png to rating5.png of the skin

It sure is a bug Smile I just said why substring compare will not work.
Note that there may be a difference between what is returned to a label and what is returned to an image - I dunno.

But either way, I'll need something a bit clearer in order to fix it (ideally a bit of skin code that allows simple reproduction Smile
Confluence > ViewMusicLibrary.xml

Add <visible>!IsEmpty(ListItem.StarRating)</visible> to the fadelabel control at line 443.

View your albums using the 'Fanart' viewmode - albums with no ratings will show no stars but the label 'Rating:' is still visible.

Thanks.
As far as I can tell, ListItem.StarRating will return an empty string if there is no videoinfotag and no musicinfotag in the item. Otherwise it will return "rating0.png" through "rating5.png" based on the assigned rating.

i.e. it returns empty for the "All Albums" item and the parent directory item. But it won't return empty (rather "rating0.png") for anything that is rated 0.

I'm not sure if this is something that should be changed or not. It's easy enough to add a check for rating > 0 in there.

Opinions?

(In the meantime, if you hide it if it's empty or "rating0.png" you should get what you want)

Cheers,
Jonathan
adding fallback="rating0.png" (for albums) is good enough for me, eg no change is needed.
I've just had a look at my music database and I think the problem is some of my albums have a negative value for the rating field. There are also loads with nothing in this field (as opposed to zero) so does this mean there isn't a rating (which is why I'd like to hide that line altogether) or they are 0?

Thanks.
Pages: 1 2