Bug 244442

Summary: [PATCH]Recently-played track is replayed too soon when Track Progression == Random and Favor != None
Product: [Applications] amarok Reporter: langstr
Component: PlaylistAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: wishlist CC: brendon, nhn, t3ddy1988, teo
Priority: NOR    
Version: 2.3-GIT   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 2.6
Sentry Crash Report:
Attachments: Patch to stop FavoredRandomTrackNavigator choosing tracks just chosen

Description langstr 2010-07-12 23:36:13 UTC
Version:           2.3-GIT (using KDE 4.4.2) 
OS:                Linux

In the pre-2.3.1 Amarok source code, the "Favor" setting of "Track Progression = Random" was completely broken: before 2.3.1, you always got "Favor = None" no matter what you asked for in the GUI.

I refactored/fixed that code in 2.3.1, and now the "Favor"ing track navigators have actually been activated. 

However, the code of these (pre-existing but inactive) track navigators is less sophisticated in one issue: they don't attempt to avoid recently-played songs. The standard "Favor = None" track navigator does avoid (the 50% most-) recently-played songs.

I do not plan to improve those "Favor != None" track navigators, because I don't use them myself.

However, this bug report can be used to coordinate people who do care about this issue.


Reproducible: Always
Comment 1 Brendon Higgins 2010-09-18 16:04:39 UTC
Created attachment 51785 [details]
Patch to stop FavoredRandomTrackNavigator choosing tracks just chosen

Hi. I do use this function. Presumably this bug is why when I skip tracks Amarok sometimes picks them again very soon afterwards.

The attached patch is my attempt at fixing this. I've based it on (with some parts copied from) the implementation of RandomTrackNavigator. The way it works here is that when calculating weights, weights for tracks in the set of recently chosen tracks are set to zero. This should make it impossible (well, technically, almost impossible) to choose these tracks.

The code compiles, and (of course) I think it works, but it requires testing. (I'm not prepared to install a dev version of Amarok on this machine. Do you guys use a chroot to test dev versions or something?) Can someone please check?

Hope this helps,
Brendon
Comment 2 Myriam Schweingruber 2010-09-18 23:26:29 UTC
Brendon, we usually just install Amarok from git locally, see also here for a detailed instruction:

http://blogs.fsfe.org/myriam/2009/09/compiling-amarok-from-git-locally-full-summary/

This has the advantage that it does not interfere with your default KDE installation, and a local build can be removed very easily by just erasing the folder.

Changing Status, no idea why this is marked as wontfix...
Comment 3 t3ddy 2011-01-17 18:59:07 UTC
This bug is still present in 2.4, since when using random of tracks I get some track played more than once and other not played at all.
I would expect them to be played all once randomly.
Comment 4 Brendon Higgins 2011-01-18 16:59:17 UTC
(In reply to comment #3)
> I would expect them to be played all once randomly.

t3ddy that's somewhat of a more fundamental issue. It might be summarised as the difference between tracks being selected randomly (or "pseudo" randomly as Amarok does it) from a given playlist, and tracks being selected in order from a playlist that has been shuffled. I suspect transforming the current way Amarok does it (the former) to the latter would require too much effort.

I'm not sure, because I don't use this function myself, but to solve your problem, perhaps there is a way to shuffle the playlist itself, and then play through normally. If there's no way to shuffle the playlist, perhaps you might file a wishlist bug for that feature.

Peace,
Brendon
Comment 5 t3ddy 2011-01-18 18:05:25 UTC
Thanks!
I've found the way to shuffle the playlist (I neither knew it exists).
Now, I shuffle the playlist and then play it in order.

Maybe my memory is joking me, but I'm quite sure that amarok 1.4 could play once, randomly, all the tracks of a playlist.
Comment 6 Myriam Schweingruber 2011-06-26 20:27:19 UTC
Brendon, does this patch still apply? If yes, please submit it to http://reviewboard.git.org. You will need an identity on http://identity.kde.org. Please submit this ASAP as we enter feature freeze on July 3rd.
Comment 7 Brendon Higgins 2011-07-02 17:08:24 UTC
FYI, updated the patch to apply to current HEAD, and posted: https://git.reviewboard.kde.org/r/101836/
Comment 8 Ralf Engels 2012-01-21 12:43:37 UTC
Git commit c0de954bda601a2e9c4d3464fcd4c5cb389541c2 by Ralf Engels.
Committed on 21/01/2012 at 13:32.
Pushed by rengels into branch 'master'.

Prevent FavoredRandomTrackNavigator choosing files chosen very recently

Author: Brendon Higgins
FIXED-IN: 2.6
REVIEW: 101836

M  +1    -0    ChangeLog
M  +55   -26   src/playlist/navigators/FavoredRandomTrackNavigator.cpp
M  +4    -1    src/playlist/navigators/FavoredRandomTrackNavigator.h

http://commits.kde.org/amarok/c0de954bda601a2e9c4d3464fcd4c5cb389541c2