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

Re:[PATCH] Feature Request: respect score in rando

Tags: None
(comma "," separated)
possebaer
Karma
0
Hello !

I had once this idea of the score being respected when amarok is in random mode: Take the score of the track - and if its below a random number btw. 1-100 it shouldn\'t be played - fetch another random track from playlist and compare its score ... until you find a track which can be played. Of course if a track has no score (0) it should be played anyways.

It isn\'t that hard task to implement and I tried to produce a quick solution. It works for me so I will post the patch in here, it\'s the output of a recent svn diff.
Of course you can delete the debug statements - but I like it seeing a track being refused :-). Would be nice if some people could try it ....

And here it is:

Index: playlist.cpp
===================================================================
--- playlist.cpp (Revision 431455)
+++ playlist.cpp (Arbeitskopie)
@@ -783,7 +783,18 @@
}
//else we stop via activate( 0 ) below
}
- else item = tracks.at( KApplication::random() % tracks.count() ); //is O(1)
+ else
+ {
+ item = tracks.at( KApplication::random() % tracks.count() ); //is O(1)
+ //ignore this track when the score is below a rand -> hi score songs will be played more often !!
+ // in the case of score 0 -> song has never been played before - play it !!
+ while( item->exactText( PlaylistItem::Score ).toInt() != 0 && item->exactText( PlaylistItem::Score ).toInt() < (KApplication::random() % 100) )
+ {
+ debug()
possebaer
Karma
0
Ok smth went wrong .... here is another try:

Index: playlist.cpp
===================================================================
--- playlist.cpp (Revision 431455)
+++ playlist.cpp (Arbeitskopie)
@@ -783,7 +783,18 @@
}
//else we stop via activate( 0 ) below
}
- else item = tracks.at( KApplication::random() % tracks.count() ); //is O(1)
+ else
+ {
+ item = tracks.at( KApplication::random() % tracks.count() ); //is O(1)
+ //ignore this track when the score is below a rand -> hi score songs will be played more often !!
+ // in the case of score 0 -> song has never been played before - play it !!
+ while( item->exactText( PlaylistItem::Score ).toInt() != 0 && item->exactText( PlaylistItem::Score ).toInt() < (KApplication::random() % 100) )
+ {
+ debug()
possebaer
Karma
0
Well smth is not working here ... preview shows full patch but thread not ...

Well if someone is interested in my patch, just leave a message where I should put it ....


greetings,
possebaer
User avatar
eean
KDE Developer
Posts
1016
Karma
0
OS
You\'ve already sent it to amarok-devel right? Thats the correct place.

Just from reading the description (haven\'t read the patch) I don\'t really get it. Random mode is supposed to be random. Can\'t the smart playlist weight by score? Actually not sure what that does really.


Amarok Developer
possebaer
Karma
0
Well that\'s true - I\'ve already sent to devel ml (being able to read helps a lot :-) ...

Well the other thing is also true - random mode should be random ... but we have this nice score thing -
we can use the score then that high scored tracks get played with a higher probability than a low scored track - that makes sense because the low score is not low without reason - it means that the user doesn\'t it want as much as others ... so when playing 100 tracks out of say 1000 it is likely that the user prefers hearing 100 with a high score....

I hope its understandable - ... thats all what the patch is about - you can also give the patch a try and watch debug output when you skip to next song while in random mode ....

greetings possebaer


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar