by ZvezdanD » Fri Dec 09, 2011 1:34 pm
Here is a quick fix for the filter bug. In line 79 instead of:
Code: Select all
SDB.DataBase.ExecSQL("INSERT INTO Filters (Pos,Name,Cond,View,Player,ContentType) VALUES((SELECT Max(Pos) FROM Filters)+1,'AutoRateAccurate','" & Cond & "','" & View & "',0,0)")
you should write:
Code: Select all
If SDB.VersionHi < 4 Then
SDB.DataBase.ExecSQL("INSERT INTO Filters (Pos,Name,Cond,View,Player,ContentType) VALUES((SELECT Max(Pos) FROM Filters)+1,'AutoRateAccurate','" & Cond & "','" & View & "',0,0)")
Else
If SDB.Database.OpenSQL("SELECT Count(*) FROM Views WHERE Name='AutoRateAccurate'").ValueByIndex(0) = 0 Then
SDB.DataBase.ExecSQL("INSERT INTO Views (Name, View) VALUES('AutoRateAccurate', '" & View & "')")
End If
SDB.DataBase.ExecSQL("INSERT INTO Filters (Pos,Name,Cond,IDView,VisibleInMainTree) VALUES((SELECT Max(Pos) FROM Filters)+1,'AutoRateAccurate','" & Cond & "', (SELECT ID FROM Views WHERE Name = 'AutoRateAccurate'), 0)")
End If
I don't use this script, so I didn't test it if there is some another problem related to the filters. After quick look at the source code I think that you could also have some problems because of changed date/time format in MM4:
http://www.mediamonkey.com/forum/viewto ... 19&t=58987. DateDiff and julianday function with 'localtime' argument is first to look at.
Here is a quick fix for the filter bug. In line 79 instead of:
[code] SDB.DataBase.ExecSQL("INSERT INTO Filters (Pos,Name,Cond,View,Player,ContentType) VALUES((SELECT Max(Pos) FROM Filters)+1,'AutoRateAccurate','" & Cond & "','" & View & "',0,0)")
[/code]you should write:
[code] If SDB.VersionHi < 4 Then
SDB.DataBase.ExecSQL("INSERT INTO Filters (Pos,Name,Cond,View,Player,ContentType) VALUES((SELECT Max(Pos) FROM Filters)+1,'AutoRateAccurate','" & Cond & "','" & View & "',0,0)")
Else
If SDB.Database.OpenSQL("SELECT Count(*) FROM Views WHERE Name='AutoRateAccurate'").ValueByIndex(0) = 0 Then
SDB.DataBase.ExecSQL("INSERT INTO Views (Name, View) VALUES('AutoRateAccurate', '" & View & "')")
End If
SDB.DataBase.ExecSQL("INSERT INTO Filters (Pos,Name,Cond,IDView,VisibleInMainTree) VALUES((SELECT Max(Pos) FROM Filters)+1,'AutoRateAccurate','" & Cond & "', (SELECT ID FROM Views WHERE Name = 'AutoRateAccurate'), 0)")
End If
[/code]
I don't use this script, so I didn't test it if there is some another problem related to the filters. After quick look at the source code I think that you could also have some problems because of changed date/time format in MM4: http://www.mediamonkey.com/forum/viewtopic.php?f=19&t=58987. DateDiff and julianday function with 'localtime' argument is first to look at.