I just updated from 3.? to 4.0.3 and now most of my scripts don't work. Here is something really simple that would delete all ratings from 20K songs in minutes. Now it starts and takes hours if it doesn't hang after a while (message box appears saying program has become non-responsive). Any thought?
- Code: Select all
Option Explicit
Public LogDebug
LogDebug = True
Sub test
logme "test"
Dim Line
Set Line = SDB.Progress
Dim plSongs
Dim Iter
Dim count
count = 0
'-------------------------------clears old ratings-------------------------------
Set plSongs = SDB.Database.OpenSQL("SELECT ID FROM Songs WHERE ID>0 AND RATING <>-1")
While Not plSongs.EOF
count = count +1
Set Iter = SDB.Database.QuerySongs( "ID=" & plSongs.ValueByIndex(0))
Line.Text = "Deleting old ratings...."
Iter.item.rating = -1
Line.Text = "Deleting old ratings...."&count
logme count &"-"& Iter.item.Title
SDB.Database.Commit
SDB.Database.BeginTransaction
Iter.Item.UpdateDB
SDB.Database.Commit
plSongs.Next
Wend
'-------------------------------end clears old ratings-------------------------------
End Sub
'---------------------------
'this is just the log script
'---------------------------
Sub logme(msg)
if LogDebug then
Dim fso, logf
Set fso = CreateObject("Scripting.FileSystemObject")
Set logf = fso.OpenTextFile("C:\Program Files\MediaMonkey\Scripts\debug.log",8,True,-1)
logf.WriteLine Now() & ": " & msg
Set fso = Nothing
Set logf = Nothing
End If
End Sub

