Page 1 of 1

Can someone modify this Tempo script for MM 3.2?

Posted: Mon Dec 14, 2009 2:04 pm
by Kazona
I found a script which automatically tags your files with the appropriate Tempo based on the BPM value. Unfortunately it doesn't seem to work with MediaMonkey 3.2. Is there anyone who can modify it so that it will work?

Code: Select all

Option Explicit

Sub SetTempo
REM "Very Slow" for BPM between 0 and 56
REM "Slow" for BPM between 57 and 82
REM "Moderate" for BPM between 83 and 145
REM "Fast" for BPM between 146 and 200
REM "Very Fast" for BPM > 200
End Sub

Dim SDB
Set SDB = CreateObject( "SongsDB.SDBApplication")

Dim KeyVerySlow
Dim KeySlow
Dim KeyModerate
Dim KeyFast
Dim KeyVeryFast

Dim dsTemp
   Set dsTemp = SDB.Database.OpenSQL("SELECT ID FROM Lists WHERE IDListType = 1 AND TextData = 'Very Slow'")
   if not dsTemp.EOF then KeyVerySlow = dsTemp.ValueByIndex(0)
   Set dsTemp = SDB.Database.OpenSQL("SELECT ID FROM Lists WHERE IDListType = 1 AND TextData = 'Slow'")
   if not dsTemp.EOF then KeySlow = dsTemp.ValueByIndex(0)
   Set dsTemp = SDB.Database.OpenSQL("SELECT ID FROM Lists WHERE IDListType = 1 AND TextData = 'Moderate'")
   if not dsTemp.EOF then KeyModerate = dsTemp.ValueByIndex(0)
   Set dsTemp = SDB.Database.OpenSQL("SELECT ID FROM Lists WHERE IDListType = 1 AND TextData = 'Fast'")
   if not dsTemp.EOF then KeyFast = dsTemp.ValueByIndex(0)
   Set dsTemp = SDB.Database.OpenSQL("SELECT ID FROM Lists WHERE IDListType = 1 AND TextData = 'Very Fast'")
   if not dsTemp.EOF then KeyVeryFast = dsTemp.ValueByIndex(0)
set dsTemp = Nothing

'Delete all Tempos
SDB.Database.ExecSQL("Delete from AddSongInfoInt WHERE DataType = 10101")

'Set all Tempos to Very Slow, where BPM between 0 and 56
if CStr(KeyVerySlow) <> "" then
   SDB.Database.ExecSQL("INSERT INTO AddSongInfoInt (IDSong, DataType, IntData) Select Songs.ID, 10101, " & KeyVerySlow & " FROM Songs WHERE BPM BETWEEN 0 AND 56")
else
   MsgBox "Largo is not part of the Tempo-List"
end if

'Set all Tempos to Slow, where BPM between 57 and 82
if CStr(KeySlow) <> "" then
   SDB.Database.ExecSQL("INSERT INTO AddSongInfoInt (IDSong, DataType, IntData) Select Songs.ID, 10101, " & KeySlow & " FROM Songs WHERE BPM BETWEEN 57 AND 82")
else
   MsgBox "Andante is not part of the Tempo-List"
end if

'Set all Tempos to Moderate, where BPM between 83 and 145
if CStr(KeyModerate) <> "" then
   SDB.Database.ExecSQL("INSERT INTO AddSongInfoInt (IDSong, DataType, IntData) Select Songs.ID, 10101, " & KeyModerate & " FROM Songs WHERE BPM BETWEEN 83 AND 145")
else
   MsgBox "Allegro is not part of the Tempo-List"
end if

'Set all Tempos to Fast, where BPM between 146 and 200
if CStr(KeyFast) <> "" then
   SDB.Database.ExecSQL("INSERT INTO AddSongInfoInt (IDSong, DataType, IntData) Select Songs.ID, 10101, " & KeyFast & " FROM Songs WHERE BPM BETWEEN 146 AND 200")
else
   MsgBox "Presto is not part of the Tempo-List"
end if

'Set all Tempos to Very Fast, where BPM > 200
if CStr(KeyVeryFast) <> "" then
   SDB.Database.ExecSQL("INSERT INTO AddSongInfoInt (IDSong, DataType, IntData) Select Songs.ID, 10101, " & KeyVeryFast & " FROM Songs WHERE BPM > 200")
else
   MsgBox "Presto is not part of the Tempo-List"
end if

Set SDB = Nothing 
I would greatly appreciate it if someone could fix this for me.

Re: Can someone modify this Tempo script for MM 3.2?

Posted: Mon Dec 14, 2009 2:57 pm
by nynaevelan
Did you look through the original forum topic, I thought someone had already modified it for 3.x?

Re: Can someone modify this Tempo script for MM 3.2?

Posted: Mon Dec 14, 2009 4:16 pm
by Kazona
Really? Hmm I'll look again then.

Re: Can someone modify this Tempo script for MM 3.2?

Posted: Mon Dec 14, 2009 6:04 pm
by nynaevelan
Kazona wrote:Really? Hmm I'll look again then.

Look on the last page: http://www.mediamonkey.com/forum/viewto ... &sk=t&sd=d