This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Media library Algorithm suggestion

Tags: None
(comma "," separated)
Vitalijus
Karma
0

Media library Algorithm suggestion

Wed Apr 19, 2006 9:34 am
Amarok algorythm
Hello, i really don\'t like the way amarok counts ranking of songs, that i\'m listening to it,
so i writed an algorythm(bad spelling) for it, so Amarok should keep values of:

VAR_PLAYCOUNT - Times song has been played
VAR_LEN - Length of song in seconds
VAR_PLAYTIME - Total amount of seconds, played song
VAR_PLAYBYUSER - How many times user manualy played song

[Algorythm]
VAR_PLAYAVETIME=VAR_PLAYTIME/VAR_PLAYCOUNT;
explain:averange play time of song

VAR_PLAYPERCENTAGE=((VAR_PLAYBYUSER/VAR_PLAYCOUNT)*25)
explain:User vs Auto song shuffle, maximum to get 25%

PERCENTAGE=(((VAR_PLAYTIME/VAR_LEN)/VAR_PLAYCOUNT)*75)
explain: counting how much you listen to this song, maximum to get 75%

RANK=PERCENTAGE+VAR_PLAYPERCENTAGE;


Sample(Python script):
VAR_PLAYCOUNT=3.0;#song has been started 3 times
VAR_LEN=360.0;#length of song in seconds
VAR_PLAYTIME=360.0;#how much i have listened to this song
VAR_PLAYBYUSER=0.0;
VAR_PLAYAVETIME=VAR_PLAYTIME/VAR_PLAYCOUNT;#vidutiniskai kiek groja sekundemis def:120
VAR_PLAYPERCENTAGE=((VAR_PLAYBYUSER/VAR_PLAYCOUNT)*25)
PERCENTAGE=(((VAR_PLAYTIME/VAR_LEN)/VAR_PLAYCOUNT)*75)
RANK=PERCENTAGE+VAR_PLAYPERCENTAGE;
print RANK;

As you can see, this song will get only 25% so if we count like this:
020<=x<40 = ** Stars
40<=x<60 = *** Stars
60<=x<85 = **** Stars
85<=x ***** Stars
this song will get only 2 stars, because averange time of listening is 2 minutes out of 6
plus user didn\'t started it manualy, but if he would start this song 3 times manualy out of 3 times started overall
this song would get 50% and thats 3 stars


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]