BPM not being interpreted correctly (Magic Nodes)

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

rovingcowboy
Posts: 14153
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)
Contact:

Post by rovingcowboy » Wed Sep 28, 2005 6:00 pm

Code: Select all

removed this code as it was bad .  my code below is the good one for my win98 computer anyways.

Last edited by rovingcowboy on Sat Oct 01, 2005 11:06 am, edited 1 time in total.
roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto ... =9&t=16724 for some help check on Monkey's helpful messages at http://www.mediamonkey.com/forum/viewto ... 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad's computer bought from computer store. )5. Samsung Galaxy 5 Android 5) 6. Proscan tablet Android 4.3 ) 7. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.

Philby
Posts: 155
Joined: Wed Aug 10, 2005 7:49 am

Post by Philby » Wed Sep 28, 2005 5:27 pm

Thats fixed it. Works perfectly now. Many thanks onkel_enno.
I will set about preparing it as a complete script that can be posted for others to use. May be a liitle time befor I can do so, but I will.
Regards
Philby

onkel_enno
Posts: 2146
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany
Contact:

Post by onkel_enno » Tue Sep 27, 2005 8:13 am

Ups :lol:

(BPM BETWEEN 0 AND 56) AND (ID IN (" & SongIDs & "))")
SansaMonkey - for SanDisk Sansa and Rockbox Users

Please no PMs for Questions which should be asked in the Forum. Thx

Philby
Posts: 155
Joined: Wed Aug 10, 2005 7:49 am

Post by Philby » Tue Sep 27, 2005 7:53 am

To onkel_enno
if CStr(KeyLargo) <> "" then
SDB.Database.ExecSQL("INSERT INTO AddSongInfoInt (IDSong, DataType, IntData) Select Songs.ID, 10101, " & KeyLargo & " FROM Songs WHERE (BPM BETWEEN 0 AND 56) AND (IDSong IN (" & SongIDs & "))")
The above line gives an error "Too Few parameters - expecting 1"
I have no idea what is wrong !
Regards
Philby

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto » Tue Sep 27, 2005 3:00 am

Cheers, I'll look forward to it! :)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.

Philby
Posts: 155
Joined: Wed Aug 10, 2005 7:49 am

Post by Philby » Mon Sep 26, 2005 6:31 pm

trixmoto,
My final version of this routine will be imbedded in a script that does a lot of other things with Custom fields, checking for lyrics, etc. But the MM developers and users have been very kind in helping me with my problems and requests (most of the time :-), so I will see if it works well, then post a customised version that just does what I have requested in this thread.
Regards
Philby

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto » Mon Sep 26, 2005 8:17 am

If you get a finished working version, please post it! :) cheers

Philby
Posts: 155
Joined: Wed Aug 10, 2005 7:49 am

Post by Philby » Mon Sep 26, 2005 8:04 am

onkel_enno,
Thanks again for your prompt assistance.
As it is almost my bedtime, I will try this out tomorrow and let you know.
Regards
Philby

onkel_enno
Posts: 2146
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany
Contact:

Post by onkel_enno » Mon Sep 26, 2005 6:43 am

@Philby

It should be s.th. like that:

Code: Select all

Dim Songs
Set Songs = SDB.SelectedSongList

Dim a
Dim SongIDs
for a = 0 to Songs.Count -1
	if SongIDs <> "" then SongIDs = SongIDs & ", "
	SongIDs = SongIDs & Songs.Item(a).ID
next

'Delete all Tempos
SDB.Database.ExecSQL("Delete from AddSongInfoInt WHERE DataType = 10101 AND IDSong IN (" & SongIDs & ")")

'Set all Tempos to Largo, where BPM between 0 and 56
if CStr(KeyLargo) <> "" then
   SDB.Database.ExecSQL("INSERT INTO AddSongInfoInt (IDSong, DataType, IntData) Select Songs.ID, 10101, " & KeyLargo & " FROM Songs WHERE (BPM BETWEEN 0 AND 56) AND (IDSong IN (" & SongIDs & "))")
else
   MsgBox "Largo is not part of the Tempo-List"
end if 
But I didn't try it!
Of course You'll have to complete the rest of the script!
Hope I could help
SansaMonkey - for SanDisk Sansa and Rockbox Users

Please no PMs for Questions which should be asked in the Forum. Thx

Philby
Posts: 155
Joined: Wed Aug 10, 2005 7:49 am

Post by Philby » Mon Sep 26, 2005 6:18 am

To onkel_enno,
Many thanks for your efforts with this script. I have impemented it and it works well. I am now wanting to run this sort of logic without it processing my entire library. I have written a couple of simple scripts to set some Custom fields, and they work only on the tracks I have selected. I would really like to hook this Tempo setting logic into my script so that the Tempo gets set only on the tracks that are selected. Naturally I have the looping logic sorted out, but could you help with the lines to just set the track currently active (I use ITM.fieldname) ? I tried .....

ITM.Tempo = 'Presto' , but got a script error.

Many thanks
Regards
Philby

onkel_enno
Posts: 2146
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany
Contact:

Post by onkel_enno » Tue Sep 20, 2005 12:37 am

Hi Guys,

sorry for replying so late.

@rovingcowboy
If you want to add it to the scripts menu, you will have to edit the script and add the two bold lines

//code
Option Explicit

Sub SetTempo
REM "Unknown" for BPM < 1
REM "Largo" for BPM between 0 and 56
REM "Andante" for BPM between 57 and 82
REM "Allegro" for BPM between 83 and 145
REM "Presto" for BPM > 145
...
End Sub
//code

and add following to the scripts.ini:

Code: Select all

[SetTempo]
FileName=SetTempo.vbs
ProcName=SetTempo
Order=6
DisplayName=Set Tempo Script
Description=...
Language=VBScript
ScriptType=0
If you want to use other captions for the tempo, you could edit the Set dsTemp-Lines
Example:
Set dsTemp = SDB.Database.OpenSQL("SELECT ID FROM Lists WHERE IDListType = 1 AND TextData = 'Presto'")
->
Set dsTemp = SDB.Database.OpenSQL("SELECT ID FROM Lists WHERE IDListType = 1 AND TextData = 'Fast'")
SansaMonkey - for SanDisk Sansa and Rockbox Users

Please no PMs for Questions which should be asked in the Forum. Thx

trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto » Mon Sep 19, 2005 8:17 am

It sounds like you're supposed to execute this script outside of MM - is that correct?

ADDITION: Yes, you can run this script outside of MM and it classifies your tracks. After you've added the headings to the "Lists" table in the .mdb as mentioned above of course! :)

rovingcowboy
Posts: 14153
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)
Contact:

Post by rovingcowboy » Mon Sep 19, 2005 8:12 am

i need more step by steps i am not a programer i just mess with what i can which is very little in scripting.

so how do i do that what you did, and how do i get this script to show up in the script menu on the tools menu?

in other words.

way in over my













:-?
roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto ... =9&t=16724 for some help check on Monkey's helpful messages at http://www.mediamonkey.com/forum/viewto ... 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad's computer bought from computer store. )5. Samsung Galaxy 5 Android 5) 6. Proscan tablet Android 4.3 ) 7. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.

Philby
Posts: 155
Joined: Wed Aug 10, 2005 7:49 am

Post by Philby » Mon Sep 19, 2005 1:06 am

OK,

A liitle bit of lateral thinking here.
The errors in the script are because the child "Tempo" node under "Classification" does not have these categories already set up. They need to be added. I did it by directly editing the List table in the mediamonkey.mdb.

Then onkel-enno's script works fine and all my Tempos are set correctly !

Happiness :D
Regards
Philby

rovingcowboy
Posts: 14153
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)
Contact:

Post by rovingcowboy » Sat Sep 17, 2005 7:24 am

OKay now you got my intrest peaked.. :o :P

will this script make autoplaylists according to the tempo of the songs.
as well as set the temp of the songs by the bpm :-? 8)

if so that will help out a lot for the internet radio's to have fast paced hour and a slow paced hour.


I also added in the needed header to the script ini file and then put the settemp script in the scripts folder.

when i started media monkey i got all the same alerts as he did. and i can not find the link to click on under the scripts header on the tools menu.?

so what did we or what didn't we screw up :o :-? :(
roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto ... =9&t=16724 for some help check on Monkey's helpful messages at http://www.mediamonkey.com/forum/viewto ... 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad's computer bought from computer store. )5. Samsung Galaxy 5 Android 5) 6. Proscan tablet Android 4.3 ) 7. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.

Post Reply