[Rhythmbox-devel] Inconsistent and unnecessary rounding of ratings



Rhythmbox internally stores song ratings as a double.  This lets the
auto-rating code adjust a song's rating gradually instead of all at
once.  However, ratings are always rounded off before displaying them to
the user.

While experimenting with adding rating support to Rhythmbox Applet [0],
I've recently noticed that Rhythmbox rounds ratings inconsistently, and
even worse, rounds them unnecessarily.

The ratings widget always rounds ratings up.  For example, a song rated
2.5 or even 2.1 will be shown as three stars.  This, in itself, isn't a
problem.

The Bonobo bindings treat ratings as integers instead of doubles (which
I'll get to in a moment), so ratings must be rounded before passing them
over to the client.  However, in this case, the ratings are rounded
*down*!  For example, a song whose rating is 2.1 or 2.5 is reported as
having a rating of 2, instead of 3!

As a result, the rating Rhythmbox displays will disagree with the rating
it tells any client whenever a song has a fractional rating.  Since all
songs start off rated 2.5, it doesn't take long for this disagreement to
become apparent.

So, at the very least, Rhythmbox ought to choose a single, consistent
way to round ratings, and should stick to it everywhere.

But more importantly, why is it necessary to round off ratings in the
Bonobo interface anyway?  It should be the client's responsibility to
decide whether it wants to see the true rating or a user-friendlier
version of it; if it wants the latter, it can round the value itself.
It should be a simple matter of changing "long" to "float" in a few
places in Rhythmbox.idl (and the corresponding spots in the code).  I
can't think of a good reason offhand why this shouldn't be done.

If this sounds like a good idea, I'll gladly make a patch to implement
this.  Any comments?


[0] http://web.ics.purdue.edu/~kuliniew/rhythmbox-applet/

Attachment: signature.asc
Description: Digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]