Re: [Rhythmbox-devel] Post-Amarok questions: related songs and auto-scoring



> BTW, the default algorithm seems to be an easy one:
> http://amarok.kde.org/wiki/FAQ#How_are_track_scores_determined.3F

I double checked, and my amarok has something different installed.
Here it is (one can easily see that the score is just average
of percentages):


#!/usr/bin/env ruby
#
# Amarok Script for custom scoring
#
# (c) 2006 Gábor Lehel <illissius gmail com>
#
# License: GNU General Public License V2

require 'uri'

loop do
    args = gets.chomp.split(" ")

    case args[0]
        when "configure"
            msg  = 'This script does not require any configuration.'
            `dcop amarok playlist popupMessage "#{msg}"`

        when "requestNewScore"
            url = args[1]
            prevscore = args[2].to_f
            playcount = args[3].to_i
            length = args[4].to_i
            percentage = args[5].to_i
            reason = args[6]

            if( playcount <= 0 ) # not supposed to be less, but what the hell.
                newscore = ( prevscore + percentage ) / 2
            else
                newscore = ( ( prevscore * playcount ) + percentage ) / ( playcount + 1 )
            end

            system( "dcop", "amarok", "player", "setScoreByPath", URI::decode( url ), newscore.to_s )
    end
end



-- 
----------------------------------------------------------------------
| Marcin Kasperski   | If we are to be successful, we must still have
| http://mekk.waw.pl |    the courage to put our faith in people as
|                    |  opposed to a process. (Booch,Martin,Newkirk)
----------------------------------------------------------------------



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