Page 19 of 43

Posted: Fri May 19, 2006 6:53 am
by DiddeLeeDoo
Auto Rating Catch-Up Playlist Generator

Auto Rating Catch-Up script, uses two dimensions to classify songs based on your MediaMonkey play history.

The first dimension is Appeal, which is set in the script, but you can choose grade of the other dimension, being Classical values.

With appeal I mean Love at First Listen sort of value, and the other Classical dimension is the longevity of the song.

Here is a screen shot of the form you get by hitting the yellow Star button on the Standard toolbar after installing it.


Nothing is done to your songs ratings, all this script does is to calculate your use of your songs and create playlists for you, so you can review the results and rate as you feel is right. You can easely select all songs in a group and give them ratings that way.

This is meant as a companion script to AutoRateSongs that keep your songs up-to-date with ratings. Songs rated lower than 1.5 Star are not included in this Auto Rating Catch-Up script, due to they are most likely not worthy of coming into the accepted group of 2.5 Stars or more. Unrated are included though

More info about AutoRateSongs can be found here. [Link to script]

To Do
Maybe also do None and Very Low in the Classical Value section

Note: I've tested this script on a playhistory of 10.000 and 25.000, and the speed seems to be around 1 second per 2.500 plays. Results may vary, so please post your findings here.

Save the below to MediaMonkey\Scripts\Auto\AutoRatingCatchUp.vbs
After a restart of MM, you'll see a yellow star in the Standard toobar.

Code: Select all

'You'll find a yellow Star in the Standard Tool-Bar after startup.
'AutoRating Catch-Up script
'By DiddeLeeDoo
'2nd version, 19 May 2006

Sub OnStartup
    Set UI = SDB.UI
    SDB.UI.AddMenuItemSep SDB.UI.Menu_TbStandard, 0, 0
    Set Mnu = SDB.UI.AddMenuItem(SDB.UI.Menu_TbStandard, 0, 0)
    Mnu.Caption = "Auto Rating Catch-Up"
    Mnu.UseScript = Script.ScriptPath
    Mnu.OnClickFunc = "ShowForm"
    Mnu.IconIndex = 64
End Sub


    Dim RatingTable(5,1)
        RatingTable(0,0) = 5
        RatingTable(0,1) = "2.5 Stars"
        RatingTable(1,0) = 10
        RatingTable(1,1) = "3.0 Stars"
        RatingTable(2,0) = 15
        RatingTable(2,1) = "3.5 Stars"
        RatingTable(3,0) = 20
        RatingTable(3,1) = "4.0 Stars"
        RatingTable(4,0) = 30
        RatingTable(4,1) = "4.5 Stars"
        RatingTable(5,0) = 50
        RatingTable(5,1) = "5.0 Stars"
    Set ni=SDB.IniFile
    Set oShExpl= SDB.Objects("BrowserWindow")
    Set oForm  = SDB.Objects("arForm")
    Set SongsID=CreateObject("Scripting.Dictionary")
    Set SongsRL=CreateObject("Scripting.Dictionary")

Sub ShowForm(x)
    Set oForm=SDB.UI.NewForm
        oForm.Common.SetRect 0, 0, 640, 480
        oForm.Common.MaxHeight = 360
        oForm.Common.MinHeight = 360
        oForm.Common.MaxWidth = 640
        oForm.Common.MinWidth = 640
        oForm.FormPosition = 4
        oForm.SavePositionName = "AutoRateCatchUpForm"
        oForm.Caption = "Auto Rating Catch-Up"
        oForm.StayOnTop = True
    Set Edt = SDB.UI.NewLabel(oForm)
        Edt.Common.SetRect 5, 10, 150, 25
        Edt.Caption = "Auto Rating Catch-Up"
    Set Edt = SDB.UI.NewLabel(oForm)
        Edt.Common.SetRect 5, 30, 150, 25
        Edt.Caption = "By DiddeLeeDoo May 2005"
    If ni.BoolValue("arCUScript","Exist") Then
    End If
    For i = 5 to 10
        If i = 10 Then Rc = "R" Else Rc = "R0"
        j = i-5
    Set SE = SDB.UI.NewSpinEdit(oForm)
        SE.Common.SetRect FromLeft, FromTop, ctrWidth, ctrHeight
        SE.Value = RatingTable(j,0)
        SE.Common.ControlName = Rc & i
    Set Lbl = SDB.UI.NewLabel(oForm)
        Lbl.Common.SetRect 58, FromTop+3, 120, ctrHeight
        Lbl.Caption = "points and up for " & RatingTable(j,1)

    Set Lbl=SDB.UI.NewLabel(oForm)
        Lbl.Common.SetRect 15, 195, 150, 25
        Lbl.Caption = "Select Classic Value Priority"
        Lbl.Autosize = True
        Lbl.Alignment = 0
    Set DD=SDB.UI.NewDropDown(oForm)
        DD.Common.SetRect 15, 210, 150, 25
        DD.Common.ControlName = "Clas"
        DD.Style = 2     ' List
        DD.AddItem "Low"
        DD.AddItem "Medium"
        DD.AddItem "High"
    If ni.IntValue("arCUScript","Classic")=0 Then
    End If

    Set Btn=SDB.UI.NewButton(oForm)
        Btn.Caption = "Display Results"
        Btn.Common.SetRect 15, 245, 150, 30
        Btn.UseScript = Script.ScriptPath
        Btn.OnClickFunc = "DoStuff"

    Set Btn=SDB.UI.NewButton(oForm)
        Btn.Caption = "Generate Playlists"
        Btn.Common.SetRect 15, 285, 150, 28
        Btn.Common.ControlName = "BtnDoMore"
        Btn.Common.Enabled = False
        Btn.UseScript = Script.ScriptPath
        Btn.OnClickFunc = "DoMoreStuff"

    Set Nfo=SDB.UI.NewPanel(oForm)
        Nfo.Common.SetRect 195, 10, 430, 315
    Set Lbl=SDB.UI.NewLabel(Nfo)
        Lbl.Common.SetRect 10, 235, 400, 20
        Lbl.Caption = "Do fine calibration by starting at the top, with 5.0 Stars first, then go one down."
        Lbl.Autosize = True
        Lbl.Alignment = 0       
    Set Lbl=SDB.UI.NewLabel(Nfo)
        Lbl.Common.SetRect 10, 250, 400, 25
        Lbl.Caption = "Use another Classic Value setting if you find you do not reach the desired results"
        Lbl.Autosize = True
        Lbl.Alignment = 0       
    Set Lbl=SDB.UI.NewLabel(Nfo)
        Lbl.Common.SetRect 10, 275, 400, 20
        Lbl.Caption = "When you feel happy with the Graph above, Generate Playlist will close this form and"
        Lbl.Autosize = True
        Lbl.Alignment = 0       
    Set Lbl=SDB.UI.NewLabel(Nfo)
        Lbl.Common.SetRect 10, 290, 400, 20
        Lbl.Caption = "start generating 'Auto Rating Catch-Up' Playlists based on the calibration"
        Lbl.Autosize = True
        Lbl.Alignment = 0       
    SDB.Objects("arForm") = oForm

    Set oShExpl=SDB.UI.NewActiveX(oForm, "Shell.Explorer")
        oShExpl.Common.SetRect 200, 15, 420, 213
        oShExpl.Common.ControlName = "oShExpl"

    Script.RegisterEvent oForm, "OnClose", "CloseSave"
    oForm.Common.Visible = True
End Sub


Sub DoStuff(x)
'HourGlass Cursor On

Set fc=SDB.Objects("arForm").Common
cClassic = fc.ChildControl("Clas").ItemIndex
Select Case cClassic
Case 0
Case 1
Case 2
End Select
sSQL="SELECT Int(Avg(Score)) AS TotTolR "_
    +"FROM (SELECT TOP 5 CD*CX AS Score "_
    +"FROM (SELECT IDG, Count(IDG) AS CD, "_
    +"Max(IDCount) AS CX "_
    +"FROM (SELECT IdSong AS IDG, "_
    +"Count(IdSong) AS IDCount "_
    +"FROM Played GROUP BY IdSong, "_
    +"Format(DatePart("&ymww&",PlayDate),'000')) "_
    +"GROUP BY IDG) "_
Select Case cClassic
Case 0
     If ni.IntValue("arCUScript","TopL")=0 Then
     End If
Case 1
     If ni.IntValue("arCUScript","TopM")=0 Then
     End If
Case 2
     If ni.IntValue("arCUScript","TopH")=0 Then
     End If
End Select

Dim Dnr(5)

For i = 0 to 5

Select Case i
 Case 0
 Case 1
      cTo = fc.ChildControl("R10").value
      cFrom = fc.ChildControl("R09").value
 Case 2
      cTo = fc.ChildControl("R09").value
      cFrom = fc.ChildControl("R08").value
 Case 3
 Case 4
      cTo = fc.ChildControl("R07").Value
      cFrom = fc.ChildControl("R06").Value
 Case 5
      cTo = fc.ChildControl("R06").value
      cFrom = fc.ChildControl("R05").value
 End Select

 sSQL="SELECT SubSQL00.IDG, Int(((CD*CX)/"&UsrTpAvg&")*100) AS Score, "_
     +"Artists.Artist, Songs.SongTitle, Songs.Rating "_
     +"FROM (SELECT IDG, Count(IDG) AS CD, Max(IDCount) AS CX "_
     +"FROM (SELECT IdSong AS IDG, Count(IdSong) AS IDCount "_
     +"FROM Played GROUP BY IdSong, Format(DatePart("&ymww&", PlayDate),'000')) "_
     +"Artists.ID = Songs.IDArtist) ON SubSQL00.IDG = Songs.ID "_
     +"WHERE (((Songs.Rating) Not Between 0 And 30) AND "_
     +"((Int(((CD*CX)/"&UsrTpAvg&")*100))>="&cFrom&" And "_
     +"(Int(((CD*CX)/"&UsrTpAvg&")*100))<"&cTo&")) "_
     +"ORDER BY SubSQL00.IDG"
 Set dbT = SDB.Database.OpenSQL(sSQL)
 While Not dbT.EOF

sDoc="<html><body topmargin=3 leftmargin=10 bgcolor=#FFFBF0>"
sDoc=sDoc&"<TABLE cellSpacing=0 cellPadding=0 border= 0 width=360>"_
+"<TR><TD colspan=4><font face=Arial size=2><b>Auto Rating Catch"_
+"-Up Results</b></font></TD></TR><TR><TD><p align=center>"_
+"<font face=Arial size=2><b>*</b></font></TD><TD align="_
+"right><font face=Arial size=1><b>Songs</b></font></TD>"_
+"<TD>&nbsp;</TD><TD>&nbsp;</TD></TR><TR><TD height=21>"_
+"<b><font face=Arial size=2>5.0</font></b></TD><TD align"_
+"=right><font face=Arial size=2>"&Dnr(0)&"</font></TD><TD "_
+"width=9>&nbsp;</TD><TD><TABLE bgColor=blue height=10 width"_
+"="&Dnr(0)&" cellSpacing=0 cellPadding=0 border= 0><TR><TD>"_
+"</TD></TR></TABLE></TD></TR><TR><TD height=21><b><font face"_
+"=Arial size=2>4.5</font></b></TD><TD align=right><font face"_
+"=Arial size=2>"&Dnr(1)&"</font></TD><TD width=9>&nbsp;</TD>"_
+"<TD><TABLE bgColor=blue height=10 width="&Dnr(1)&" cellSpacing"_
+"=0 cellPadding=0 border= 0><TR><TD></TD></TR></TABLE></TD>"_
+"</TR><TR><TD height=21><b><font face=Arial size=2>4.0</font>"_
+"</b></TD><TD align=right><font face=Arial size=2>"&Dnr(2)&"</font>"_
+"</TD><TD width=9>&nbsp;</TD><TD><TABLE bgColor=blue height=10 "_
+"width="&Dnr(2)&"cellSpacing=0 cellPadding=0 border= 0><TR><TD>"_
+"</TD></TR></TABLE></TD></TR><TR><TD height=21><b><font face="_
+"Arial size=2>3.5</font></b></TD><TD align=right><font face="_
+"Arial size=2>"&Dnr(3)&"</font></TD><TD width=9>&nbsp;</TD>"_
+"<TD><TABLE bgColor=blue height=10 width="&Dnr(3)&" cellSpacing"_
+"=0 cellPadding=0 border= 0><TR><TD></TD></TR></TABLE></TD></TR>"_
+"<TR><TD height=21><b><font face=Arial size=2>3.0</font></b></TD>"_
+"<TD align=right><font face=Arial size=2>"&Dnr(4)&"</font></TD>"_
+"<TD width=9>&nbsp;</TD><TD><TABLE bgColor=blue height=10 width"_
+"="&Dnr(4)&" cellSpacing=0 cellPadding=0 border= 0><TR><TD></TD>"_
+"</TR></TABLE></TD></TR><TR><TD height=21><b><font face=Arial "_
+"size=2>2.5</font></b></TD><TD align=right><font face=Arial "_
+"size=2>&nbsp;&nbsp;"&Dnr(5)&" </font></TD><TD width=9>&nbsp;"_
+"</TD><TD><TABLE bgColor=blue height=10 width="&Dnr(5)&" "_
+"cellSpacing=0 cellPadding=0 border= 0><TR><TD></TD></TR>"_

Set Doc=SDB.Objects("BrowserWindow").Document
    Doc.Write sDoc
    fc.ChildControl("BtnDoMore").Common.Enabled = True
    'HourGlass Cursor Off
End Sub


Sub DoMoreStuff(x)
    oForm.Common.Visible = False
Set Prg = SDB.Progress
    Prg.MaxValue = SDB.Objects("ToDoLst").Count
    Prg.Text="Adding tracks to playlist..."
Set MthrPlst=SDB.PlaylistByTitle("").CreateChildPlaylist("Auto Rating Catch-Up")
    For i = 0 to 5
        Set ChldPlst = MthrPlst.CreateChildPlaylist(RatingTable(5-i,1))
        Do While SDB.Objects("ToDoLvl").Item(n)=i
           If Prg.Terminate Then Exit Do
        If Prg.Terminate Then Exit For
End Sub   

Sub CloseSave(m)
End Sub


Sub SaveUserSettings
Set fc=SDB.Objects("arForm").Common
  If ni.StringValue("arCUScript","LastLevel")="" Then
  ElseIf DateDiff("d", ni.StringValue("arCUScript","LastLevel"), Date) > 50 Then
  End If
End Sub

Sub EmptyStuff
End Sub
Note to other scripters.
No modified version of this script should be posted anywhere else than this thread, and never in a complete form. Only the modified part should be posted in this thread and in this tread only!

Posted: Fri May 19, 2006 10:22 am
by rovingcowboy
well it took about 5 seconds on this winXp but that is only about 3 years worth of database songs to go through.

with your default settings. 8)

the win98 is also a slower cpu. and 5 years of database songs. so it might take longer. :o


how ever you know me. get that steel ruler out.

this changing your scripts is getting harder but i want them other 5 star ratings. soo.. :roll: :wink:

then to think again. this script does not adjust the file's rating it just makes a playlist? are you going to included the rating or just let that up to the keep update rating script.? :-?

so i got that changed already. :)

no need to change this one.? 8)


Posted: Fri May 19, 2006 10:36 am
by DiddeLeeDoo
I've had a few ... glasses with stuff in them... so all your smilies is not that clear..

Basically this is a Gentlemens Kinds of Rating Script. Present gentle ability with style.

Doing it in a range from 0 - 5 does not quite make sense to me, as skips suppose to bring them down....... What I mean is that it should not all be left to a formula. Give it a human touch too, by the skipping button..

An All-Formula version is something Big_Berny is doing at the moment I think... he's still working hard to give one like that as far as I know.

Posted: Fri May 19, 2006 10:41 am
by rovingcowboy
sorry i do tend to use the smilies to give the feel of the line i just typed.

but after a few of that landdown under bubblie stuff it is amazing you can see at all.

that stuff is strong.

up here it is only 1/8th as strong as down there.

i did not change your script as i found i did not need to.

almost put a smilie in this message too.

Posted: Fri May 19, 2006 10:44 am
by DiddeLeeDoo
:D I saw some fun smilies in one of the forums you suggested... there's some brilliant ones out there...

Dings are a bitt stong here... but ten you now, it's aussie stuff.. anyways..

Autorate problems

Posted: Fri May 19, 2006 12:57 pm
by billywizz
Im having no luck with this script at all. Tried twice now save the script in the three files as decribed but still it doesnt work for me at all. I see no signs of anything being rated although I can see the autorate options menu.

What am I doing wrong here??

Posted: Fri May 19, 2006 1:20 pm
by rovingcowboy

let me tell you how to do this. you read it even if you think you done it proper. then if you have done what i wrote and it still does not work.

you post back a message saying the same way just what you did.
so we can see if your getting the code copied proper from the web?

okay do this.

copy the complete script posted for the autorate keep updated script.

past it in note pad,

now you need to open the ini file in the folder for scripts in monkey's program folder.

now copy just that first section of the autorate script that is for the ini file

paste it in to the bottom of the ini file.

remove all the ' marks from in front of the lines or the monkey wont see it when he reads the ini file.

change the order number of that little bit you just pasted in. the order number is just the count number of how many script codes you have listed in the ini file.

now save the ini file and close it.

now copy the section for the option sheet out of the code and paste it in to another brand new notepad. save it by the name that you are told to.
and close it now put that new options sheet file in to the folder in monkeys script folder that is called auto.

now copy the last part out of the code and save it in another new notepad and save it by the name your told to. and close that vbs file and put it in to the scripts folder in monkey's program folder.

now start monkey you then go to the menu bar and click on the word tools. on that menu go to the word options and click on it.

when the panel comes up you will see in the tree list on that options panel
the word autorate, click on it. now that options should up.

you set them the way you want them to do.

now play your songs. the rating will be adjusted

if there is not enough playcounts for the song yet diddeleedoo's script will not post any stars on it.

which is because he wont code in the lower 5 stars.
he just can't see the need for those because he don't use them.

when you do get stars on your songs if you skip them then he shows the lower stars so you can see your rating is dropping for that song.

so when your song gets enough playcounts in the history log for the song the rating will be posted.

the autorating keep updated script works in the background watching what is being played.

then it updates that one song and watches your next song as long as you don't skip it after your set preview time limit then the song wont go down in ratings.

and it will get a rating posted but only after it gets to the playcount that is set to show the stars at 2.5 stars.

do you understand now.

Posted: Fri May 19, 2006 8:30 pm
by DiddeLeeDoo
Thank you Roving Cowboy!

I'll try to do it a short form.

3 files needs to be attended.

With a freshly restarted MediaMonkey, go to
Tools - Options - Library - Auto Rating, and hit the Enable CheckBox in the top left corner, then hit OK, and after the second song you should see the ratings start.

Possible trap: AutoRateSongs.vbs needs to have correct filename, and notepad tend to add .txt at the end of files. If you use notepad, make sure to use double quotes in front and back of the filename... like "AutoRateSongs.vbs" when you save it to \MediaMonkey\Scripts\

Posted: Sat May 20, 2006 10:17 am
by billywizz
Thanks for your replys guys.
I have been through setting this up again. Paying careful attention to copying and pasting the script into the appropriate folders as described. The VBS files are saved correctly as is the Script.ini file. I go back and restart MM check the enable box in options and play a track 3 or 4 times. Should I see it rated in the Rating column ?. If so, I still dont - so cant understand it.

If I double click on the AutoRateSongs.vbs in explorer i get an Windows Script Error message.:--
Line : 8
Char: 1
Error: Object required 'SDB'
Code: 800a01a8
Source: MS Runtime Error

Could this be the problem? If so how to resolve it?

Im a newbie to MM so hope you can help out 'cause this script sounds great if I can get it to work

Posted: Sat May 20, 2006 10:30 am
by DiddeLeeDoo
The script is not designed for double-clicking, so that is not the problem. A few more lines needs to be added for it to work as a double-click script.

Strange one really..... The timing is that a song you play, will be rated when you start playing a new one...

This is done to ensure that the currently playing song is totally undisturbed.

I recall having some stubborn files, which featured bad tags... with those I did
Tools - Advanced Tag Management - Remove IDv1 and IDv2 Tags
first to clean the bad tags out, and then afterwards

Tools - Advanced Tag Management - Syncronize Tags
to write new and proper tags to the files.

You suppose to see the ratings being done when a new song starts playing.. simple as that really..

Is it ordinary mp3 files you're testing with?

For the fun of it, could you rate a song 1.5 Star manually, and then play it to see if it jumps up to 2.5 Star? (It will not jump up before next song starts playing) and you will be helped by having the Now Playing window open..... that you find in the View Menu....... Now Playing, as that's where you see the ratings being done 'live'

Posted: Sat May 20, 2006 10:49 am
by billywizz
OK thanks again.

I seem to have cracked it. I was using winamp as the player and when using that nothing was being Rated when played. As soon as I started using the MM built in player it works !!!! and tracks are being rated as soon as played. Great. Thanks for all your help. Shame it wont rate when I use Winamp tho as I like to use Toaster to display the now playing details.

Posted: Sat May 20, 2006 10:58 am
by DiddeLeeDoo
It would be delightful if MM featured improved Winamp plug-in support. These kinds of things have to be done by someone, and hopefully the MM community will be enriched with a plug-in guru one day...

Posted: Sat May 20, 2006 5:39 pm
by rovingcowboy
billywizz wrote:OK thanks again.

I seem to have cracked it. I was using winamp as the player and when using that nothing was being Rated when played. As soon as I started using the MM built in player it works !!!! and tracks are being rated as soon as played. Great. Thanks for all your help. Shame it wont rate when I use Winamp tho as I like to use Toaster to display the now playing details.
billy go to

that will tell you how to use toaster with media monkey.

also look in the mmskins message for my download page as i have skins that work with toaster too.

Posted: Sat May 20, 2006 8:13 pm
by DiddeLeeDoo
Cool, Guru 1 fixed problem... Don't use toaster here, just have had some problems with plug-ins that do playlist control.

Posted: Mon May 22, 2006 3:29 am
by billywizz

This all works perfectly now. Thanks for the tips.
This script rocks!!!