GNOME Bugzilla – Bug 544680
Weighted random mode
Last modified: 2009-06-13 00:46:42 UTC
Right now the patch is just a modification of Banshee.Services/Banshee.Collection.Database/DatabaseTrackListModel.cs which implements random selection based on songs ratings. If someone wants to give a hand/suggestions...as a beginner I'm full of doubts: -where this code should be placed (the ShuffleStars class)? -when to re-Initialize the weights? -will it be better to use this as an Extension or as another shuffle mode? -... :) [patch diffed against revision 4247]
Created attachment 115243 [details] [review] first version of the patch
(In reply to comment #0) > If someone wants to give a hand/suggestions...as a beginner I'm full of doubts: > -will it be better to use this as an Extension or as another shuffle > mode? I'm not a developer, but I'd imagine that the best way to implement this would be as an extension rather than a replacement for the current shuffle code. The mailing list would be a good place to discuss that, as not all the contributors read the bugs as diligently, but there are a number of people who would be willing to help. Seems like a nice idea though; I look forward to trying it!
I think that this really should be a new shuffle mode, like "Shuffle by Artist" or "Shuffle by Album". Those two are visible but greyed out in the UI because they're not implemented. I had a look on how to add a shuffle mode, but couldn't figure how to connect the UI stuff to the GetRandom code. This shuffle mode could be integrated directly in banshee, or through an extension, depending on our maintainers' thoughts about this.
Yes sorry I didn't point out that the actual patch was just a kind of "proof of concept" (I wanted to try the new shuffling) - I'm going to start trying to figure out how to made it an extension or a possible choice in the shuffle menu; but I'd like to hear which one would be the best in maintainers' and users' opinion (btw I agree with Bertrand).
Created attachment 115441 [details] [review] Version connected with menus Here it is the version connected with menus, allowing shuffle by song and new weighted mode. As a novice I'm aware that it will be a mess, but maybe could work as a starting point (I'll have to figure out what MemoryTrackListModel does and if there should be some new implementation there...).
Created attachment 115442 [details] [review] Version connected with menus Here it is the version connected with menus, allowing shuffle by song and new weighted mode. As a novice I'm aware that it will be a mess, but maybe could work as a starting point (I'll have to figure out what MemoryTrackListModel does and if there should be some new implementation there...).
Obsoleting one patch for the other, since it looks like everything got posted twice.
Elena, this is really good. Can you change Weighted to Rating, and star(s) to rating as well? Use @" ... " for multi-line strings (vs " " + " " etc)
Created attachment 126389 [details] [review] Changed names and multi-line strings Here the requested modifications of the patch, against rev. 4915
Hey Elena, sorry there's been no feedback for so long. I just spent quite a while looking at the code, and I'm probably just forgetting, but can you explain what the overall purpose is? What is the end result - that items with a more common rating are played more often?
Highest rated songs are played more often, yes. And for lazy-raters (like me :) ) unrated songs are considered as 3-stars.
Created attachment 135921 [details] [review] Updated to git master + fixes Elena, thanks for the patch! I used this feature all the time in iTunes and missed it in Banshee. I updated your patch to apply to git master. I also added these changes: * Replaced ShuffleRating class with GetRandomRating method. * Re-read ratings distribution on each call. * Reduced the number of database queries from 5 to 1, making the distribution calculation more efficient. * Use selected model (and not the entire Library) when calculating the distribution. * Use the random_began_at time-stamp as the other shuffle modes. * Fixed a bug when unrated tracks have never been played.
Created attachment 136001 [details] [review] Changed weights Changed the weights from [1, 2, 3, 4, 5] to [1, φ, φ², φ³, φ⁴].
Thanks a lot, Elena and Alexander! I committed the most recent patch (slightly tweaked for some recent changes to the random code).