Closed MikeSiLVO closed 3 months ago
Sorry can you explain a bit more what you're doing and how it relates to SV?
If you're talking about this method https://github.com/jurialmunkey/script.skinvariables/wiki/Skin-Tools-and-Helpers#get-dbtype-details-container
It just requests from json rpc and returns the values. It doesn't do any label formatting - that's how the values are stored in your library database and what it gets back from json rpc.
I am trying to use the DBTYPE details in a hidden list with id "9100"
plugin://script.skinvariables/?info=get_dbitem_movie_details&dbid=$INFO[ListItem.DBID]&reload=$INFO[ListItem.Title]
Then when calling the ratings I get the above numbers instead of 6.6 i see 6.599999 etc..
$INFO[Container(9100).ListItem.Property(ratings.imdb.rating)]
$INFO[Container(9100).ListItem.Property(ratings.tomatometerallcritics.rating)]
$INFO[Container(9100).ListItem.Property(ratings.tomatometerallaudience.rating)]
Am I misunderstanding how to use the DBTYPE details?
Hmm, I just checked my DB and indeed many are formatted strangely but the longest ones only go six decimal places not 15 and many also have the correct rating like 6.5 instead of anything longer.
Almost all my library has been scraped using the movie db python 3 scraper. Any idea whats going on here? Not sure how I can use this as replacement for the ratings outside DialogVideoInfo... ðŸ’
I just made an NFO for the movie posted above, refreshed the item, and this is a couple of the ratings from the NFO:
<rating default="false" max="100" name="tomatometerallaudience">
<value>66.0</value>
<votes>4115</votes>
</rating>
<rating default="true" max="10" name="imdb">
<value>6.6</value>
<votes>133224</votes>
</rating>
It is still showing the really long number in the INFOlabel...
From my DB:
No idea where that 6.59999 is coming from...
I just checked my DB and indeed many are formatted strangely but the longest ones only go six decimal places not 15 ... Any idea whats going on here?
Float point calculation inaccuracy because floats are approximations not accurate numbers. Only integers provide accurate numbers.
for e.g. 0.1 + 0.1 + 0.1
does not equal 0.3
Which is why using floats to store values is a bad idea. Not sure why someone decided on that instead of using an integer percentage. Will need to do some wrangling unfortunately....
Added _integer
_percentage
and _rounded
affixes for floating point numbers. The _percentage
affix assumes a value out of 10 (which seems to be how db stores ratings -- which is probably source of floating point error in the first place as it is dividing by max value to get to a number out of 10).
e.g.
ListItem.Property(ratings.imdb.rating)
8.399999618530273
ListItem.Property(ratings.imdb.rating_integer)
8
ListItem.Property(ratings.imdb.rating_rounded)
8.4
ListItem.Property(ratings.imdb.rating_percentage)
84%
Works great, thanks!
Looking to use this as replacement for Embuary Helper to provide ratings but the numbers are too long and/or not rounded correctly?
Thanks :)