Kodi Community Forum

Full Version: [Bug] some aspect of $COMMA or SubString is broken on Gotham builds after Dec 5, 2013
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
So this was working on earlier Windows Gotham builds but it has been broken for at least a month now.
Code:
    <variable name="value_ratingcolor">
        <value condition="!SubString(ListItem.Votes,$COMMA)">FFFF0000</value>
        <value condition="SubString(ListItem.Votes,1$COMMA,Left)">FFFF5555</value>
        <value condition="SubString(ListItem.Votes,2$COMMA,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,3$COMMA,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,4$COMMA,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,5$COMMA,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,$COMMA)">FF00FF00</value>
    </variable>

ListItem.Votes is working (when used as a Label), but comparing against it doesn't.
I have even tried <value condition="SubString(ListItem.Votes,1)">FF00FF00</value> which should work with any item with a 1 in Votes, even that doesn't work. It is defaulting to FFFF0000, so "variable name" is working.

Again, this used to work with previous builds of Gotham, and it still doesn't work with the very newest nightly (for WIndows).

Is this a bug, or has something changed?
Ignore.
Can't really test atm, but the last value should be what it defaults to if those above it are false.
The first (and second ect) only gets used when the condition is true for some reason.
So if you are seeing FFFF0000 that means the condition for FF00FF00 never even gets checked.
What happens if you move the first value down to the last position? Or test without the first value?
I observed it as top-down-stop, in that each "true" assigns the variable and then stops processing. So the first line says "If ListItem.Votes doesn't have a comma in it, then set it to RED", the lines in between look for different numbers like "1,xxx" or "2,xxx", the last line should effectively say "If nothing before has had a true, and there is still a comma in ListItem.Votes, set it to GREEN"

This all worked fine before, and then it just stopped. The only change was the Gotham build. Here is my post where it was worked out how to do it.
[Solved (for Gotham)] Weighted IMDB/TMDB rating via color, based on votes
Notice the green star, it worked before.
Image
The orange star.
Image
The yellow star.
Image

That's why I was leaning towards bug or some sort of change. Thanks for looking at it, any help is welcomed.
(2014-01-21, 10:25)MacGyver Wrote: [ -> ]I observed it as top-down-stop, in that each "true" assigns the variable and then stops processing. So the first line says "If ListItem.Votes doesn't have a comma in it, then set it to RED", the lines in between look for different numbers like "1,xxx" or "2,xxx", the last line should effectively say "If nothing before has had a true, and there is still a comma in ListItem.Votes, set it to GREEN"
My suggestion of moving the first down to the bottom was only so you could better see what was going on.
Your variable would still work as: If none of the above are true set it to red.

The reason i said that was because right now, with your first condition always being true (because that's the one we see), the second won't ever get checked, even if you change the second one to:
Code:
<value condition="SubString(ListItem.Votes,1)">FF00FF00</value>
Which still works.

Also, i don't know why Hitcher removed his post, as he was likely correct, in that something changed in the ListItem.Votes label.
I don't know why you are still seeing a comma when using ListItem.Votes as a label but i am not.
I removed it when I realised he'd already checked it as a label.

Quote:ListItem.Votes is working (when used as a Label)
So here is ListItem.Label of non focused items replaced with ListItems.Votes. As you can see mine contains commas.
Code:
                    <!--     <label>$INFO[ListItem.Label]</label>
                    -->     <label>$INFO[ListItem.Votes]</label>
Image


Here is the order flipped around. (Red on the bottom as you suggested)
Code:
        <value condition="SubString(ListItem.Votes,1$COMMA,Left)">FFFF5555</value>
        <value condition="SubString(ListItem.Votes,2$COMMA,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,3$COMMA,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,4$COMMA,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,5$COMMA,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,$COMMA)">FF00FF00</value>
        <value condition="!SubString(ListItem.Votes,$COMMA)">FFFF0000</value>
No change.
Image




For good measure, here is the red one commented out.
Code:
    <!--    <value condition="!SubString(ListItem.Votes,$COMMA)">FFFF0000</value>
    -->    <value condition="SubString(ListItem.Votes,1$COMMA,Left)">FFFF5555</value>
        <value condition="SubString(ListItem.Votes,2$COMMA,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,3$COMMA,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,4$COMMA,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,5$COMMA,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,$COMMA)">FF00FF00</value>
And it yields.

Image


So is this a bug?
IMDB: Inception (2010): Ratings: 8.8/10 from 904,093 users
13.0-ALPHA12 Git:20140109-3751d14 (10-Jan) (Win7)
ListItem.Label replaced with ListItem.RatingAndVotes
Image

Now with ListItem.Label replaced with ListItem.Votes in list view itemlayout only, using the following VAR for textcolor:
Code:
<variable name="value_ratingcolor">
    <value condition="SubString(ListItem.Votes,1)">FFFF5555</value>
    <value condition="SubString(ListItem.Votes,2)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,3)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,4)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,5)">FF00FF00</value>
    <value>FFFF0000</value>
</variable>
What results does that show you? It shows me this:
Image

I can even do:
Code:
<variable name="value_ratingcolor">
    <value condition="!IntegerGreaterthan(ListItem.Votes,50)">FFFF5555</value>
    <value condition="!IntegerGreaterthan(ListItem.Votes,100)">FFFF5555</value>
    <value condition="!IntegerGreaterthan(ListItem.Votes,150)">FFFFFF00</value>
    <value condition="!IntegerGreaterthan(ListItem.Votes,350)">FFFFFF00</value>
    <value condition="!IntegerGreaterthan(ListItem.Votes,600)">FF00FF00</value>
    <value condition="IntegerGreaterthan(ListItem.Votes,1000)">FF00FF00</value>
    <value>FFFF0000</value>
</variable>
But everything always has the same color. I'm going to install today's nightly now.

[EDIT] Today's nightly, re-scanned movies, same result.
So this doesn't make any sense (unless $COMMA is broken):
This:
Code:
<value condition="SubString(ListItem.Votes,7)">FFFF5555</value>
    <value condition="SubString(ListItem.Votes,8)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,6)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,5)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,993)">FF00FF00</value>
    <value>FFFF0000</value>
works (if albeit simplistically and only to prove it can set the color and is stopping at the first match)
Image





But as you can see in the Label field (replaced by ListItem.Votes to display its contents)
the value of that item is 140,993 and yet this (going off the assumption that there is really no comma there):

Code:
<value condition="SubString(ListItem.Votes,7)">FFFF5555</value>
    <value condition="SubString(ListItem.Votes,8)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,6)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,5)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,0993)">FF00FF00</value>
    <value>FFFF0000</value>
gives you this
Image



and this:
Code:
<value condition="SubString(ListItem.Votes,7)">FFFF5555</value>
    <value condition="SubString(ListItem.Votes,8)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,6)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,5)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,$COMMA993)">FF00FF00</value>
    <value>FFFF0000</value>
also gives you this
Image

But this works:
Code:
<value condition="SubString(ListItem.Votes,7)">FFFF5555</value>
    <value condition="SubString(ListItem.Votes,8)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,6)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,5)">FFFFFF00</value>
    <value condition="SubString(ListItem.Votes,140,Left)">FF00FF00</value>
    <value>FFFF0000</value>
and will produce
Image



So given the original problem, and the results here, it has to mean that $COMMA isn't working? Mystery solved? (except why MassIV's ListItem.Votes is showing ListItem.RatingAndVotes instead of Votes)
(2014-01-22, 18:12)MacGyver Wrote: [ -> ]So given the original problem, and the results here, it has to mean that $COMMA isn't working? Mystery solved? (except why MassIV's ListItem.Votes is showing ListItem.RatingAndVotes instead of Votes)
My ListItem.Votes is not displaying ListItem.RatingAndVotes. I first showed ListItem.RatingAndVotes (with the movie Inception only). Because ListItem.RatingAndVotes is also showing wrong votes. And afterwards i showed ListItem.Votes for all the movies in a list.
So I have no idea why my ListItem.Votes are seemingly random numbers.

Anyways... it's in the hands of the devs now.
(2014-01-22, 21:47)MassIV Wrote: [ -> ]So I have no idea why my ListItem.Votes are seemingly random numbers.

Smile If it's not one thing, it's another. Thanks for helping me work out that it must be $COMMA that is broken.
Just a thought but have you tried using

Code:
& # 4 4 ;

(without the spaces) instead of $COMMA?
Wow Hitcher, that must be some sort of XBMC equivalent I've never heard of for /x2C.
I see how it should yield a "," and it does as a Label, but after reviewing about 30 examples using ( ,, = &# 44;, ):
Code:
        <value condition="!SubString(ListItem.Votes,,)">FFFF0000</value>
        <value condition="SubString(ListItem.Votes,1,,Left)">FFFF5555</value>
        <value condition="SubString(ListItem.Votes,2,,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,3,,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,4,,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,5,,Left)">FFFFFF00</value>
        <value condition="SubString(ListItem.Votes,,)">FF00FF00</value>
It produces outputs like this:
90,243 - yellow
38,463 - yellow
25,901 - orange
14,008 - orange
1,412 - orange
80,896 - green
155,250 - orange
80 - green
90,447 - yellow
6,886 - green
never an example that yielded red


So it looks almost like the output you would get from a SubString(ListItem.Votes,string,Left) minus the "left", it's almost like it turns off "left" and ignores the ",". But it doesn't work.


UPDATE: After seeing how the forum treated it, I'm sure that the portion of code reading the xml, is reading it as ",," also and leaving off the Left.
It's unicode - http://www.fileformat.info/info/unicode/.../index.htm

EDIT: I'd try the nightlies until I found out which one changed this behaviour, then check Github for any commits around that date.
My guess is that the $COMMA still works fine in this circumstance (and any others - try it out in any old infolabel), but the comma you're looking for in the votes is different to a plain, ASCII comma, which is what the $COMMA is being replaced as.

i.e. the utf8 string that is the vote string is being interpreted in a different way than it was before.

Did you happen to re-scan during this time? (from .nfo files counts).

You might be able to track things further if you dump your video database to a single XML file and then look at it using a hexdump utility.
Pages: 1 2