Basically all it does is create a node under your "Now Playing" node which duplicates tracks once per every half-star in the tracks rating. So if you play the songs from this node with shuffle turned on, Media Monkey will be more likely to pick the songs with a higher rating since they are duplicated more. For example a song with a 5 star rating is 10 times more likely to be played than one with a 1/2 star rating. 0 star songs (bomb rating) are dropped completely, and un-rated songs are weighted the same as 2.5 stars.
So to use this, just populate the "Now Playing" node with whatever you want to listen to, then start playing the "Weighted Shuffle" node (and make sure you have shuffle turned on).
Some of this script is based off the tutorial scripts and other scripts I found on the forums, but I don't remember which ones, so sorry if I ripped off any code snippets, etc, from anyone.
Here is the script:
Code: Select all
Sub OnStartup Dim Tree Set Tree = SDB.MainTree Dim Node Set Node = Tree.CreateNode Node.Caption = "Weighted Shuffle" Node.IconIndex = 40 Node.UseScript = Script.ScriptPath Node.OnFillTracksFunct = "FillNPTracks" Tree.AddNode Tree.Node_NowPlaying, Node, 3 ' Add as the last child End Sub Sub FillNPTracks( Node) Dim min_rating min_rating=6 While min_rating<100 And Not Script.Terminate Dim i i=0 Dim List, Trcks Set List = SDB.Player.CurrentPlaylist Set Trcks = SDB.MainTracksWindow While i<List.Count And Not Script.Terminate If (List.Item(i).Rating > min_rating) Then Trcks.AddTrack List.Item(i) Else If (min_rating <= 46 And List.Item(i).Rating = -1) Then 'include unknowns 5 times Trcks.AddTrack List.Item(i) End If End If i=i+1 WEnd min_rating=min_rating+10 WEnd Trcks.FinishAdding End Sub
Feel free to let me know if I did anything stupid or if you have any improvements or anything