Scripts in 4.0.3

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

Scripts in 4.0.3

Postby jon_beeker » Sat Mar 24, 2012 1:38 pm

Hello All,
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   


jon_beeker
 

Re: Scripts in 4.0.3

Postby Thanasis » Sat Mar 31, 2012 10:22 pm

Why don't you try your code by deducting some code at a time so you see where is the problem ?????

I see you are writing to a log file. Try without it and see what happens.

If you find the section which causes you problems, post back.....

Take Care
Athas
Thanasis
 
Posts: 84
Joined: Sun Aug 28, 2011 2:53 am


Return to Addons developer forum

Who is online

Users browsing this forum: No registered users and 4 guests