Here's how this works as I read it:
if( playcount <= 0 ) # not supposed to be less, but what the hell.
newscore = ( prevscore + percentage ) / 2
If the song has never been played before they simply take the percentage of the song completed and divide it by two. A new song played the whole way through would result in a score of 50. 25 if you only play half the song etc.
else
newscore = ( ( prevscore * playcount ) + percentage ) / ( playcount + 1
If the song has been played before then we need to take an faux-average of the score so take the existing score and multiply it by the number of times its been played. a song with a score of 50 and played 10 times then will have a 500. Now add the percentage of completion (say 100% for simplicity) now we have 600. Now take this new number and divide it by the new playcount which is the old one plus 1. 600 / 11 = 54.55 (rounded of course) and that would be the new score. So because you let it play the whole way through the score went up. Now lets say you skipped the song after only 10% completion. we would have 525 / 11 = 47.73. It has dropped because you obviously didn't want to hear that song. Over time the scores for songs will stabilize and give you a pretty good guess as to what you like and might want to hear.
Now this algorithm is not perfect and there are some far better ones out
there to be used.. but that would be the essential data that an
extension would need access to in order to score a song automatically.
Gabriel Burt wrote:
On Fri, Oct 3, 2008 at 2:02 PM, Brian Lucas <bcl1713 gmail com> wrote:I would like to do some work or help with work on an extension regarding this bug: http://bugzilla.gnome.org/show_bug.cgi?id=419844. I really like the algorithm that Amarok uses for this purpose but I'm not sure if it will be implementable in banshee as I'm not sure if the required information is retained or available upon track change. Here is the algorithm from Amarok in ruby: if( playcount <= 0 ) # not supposed to be less, but what the hell. newscore = ( prevscore + percentage ) / 2 else newscore = ( ( prevscore * playcount ) + percentage ) / ( playcount + 1 ) endWhere does prevscore get initialized? Is it initialized to zero? What is percentage? Can you explain the logic of the algorithm in English? Looking at the code, I don't quite get why things are the way they are. Thanks, Gabriel _______________________________________________ Banshee-list mailing list Banshee-list gnome org http://mail.gnome.org/mailman/listinfo/banshee-list