Page 1 of 3

Import BPM from MixMeister text-file - MixMeisterImport 1.02

Posted: Sat Jan 12, 2008 8:29 pm
by Big_Berny
Hi guys,
yesterday I wantes Mixmeister to detect all BPMs of my song. Unfortunately it couldn't save the BPMs in the file, don't know why. But I have a text-file where the informations are stored in.

It's strucktured like "Path[Tab]Title[Tab]Artist[Tab]BPM[Tab]".
The first three lines here:

Code: Select all

D:\Eigene Dateien\Eigene Musik\Final\!!!\2007 - Myth Takes\01 - !!! - Myth Takes.mp3	Myth Takes	!!!	97.07	
D:\Eigene Dateien\Eigene Musik\Final\!!!\2007 - Myth Takes\02 - !!! - All My Heroes Are Weirdos.mp3	All My Heroes Are Weirdos	!!!	122.31	
D:\Eigene Dateien\Eigene Musik\Final\!!!\2007 - Myth Takes\03 - !!! - Must Be The Moon.mp3	Must Be The Moon	!!!	120.06	
Does someone have a idea how I can import them? The first problem I have is that I don't know how to get the Path and the BPM (=How to extract from the whole line) and I don't know how to get the song with the path (=Don't know the sql-query).
Would be cool if someone would have the basic lines so that I can import the BPMs.

Thanks! :)

Posted: Sun Jan 13, 2008 11:43 am
by trixmoto
Well to read the lines of the file you want to have a loop, something like this...

Code: Select all

Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim txt : Set txt = fso.OpenTextFile(xml,1,False)
Do While Not txt.AtEndOfStream
  Dim str : str = Trim(txt.ReadLine)
Loop
To get the parts of the line you want you can split the string into an array, like this...

Code: Select all

Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim txt : Set txt = fso.OpenTextFile(xml,1,False)
Do While Not txt.AtEndOfStream
  Dim str : str = Trim(txt.ReadLine)
  Dim arr : arr = Split(str,Chr(9))
  Dim fil : fil = arr(0)
  Dim bpm : bpm = arr(3)
Loop
And then to find the track you need to query like this...

Code: Select all

Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
Dim txt : Set txt = fso.OpenTextFile(xml,1,False)
Do While Not txt.AtEndOfStream
  Dim str : str = Trim(txt.ReadLine)
  Dim arr : arr = Split(str,Chr(9))
  Dim fil : fil = Mid(arr(0),2)
  Dim sit : Set sit = SDB.Database.QuerySongs("AND (Songs.SongPath = '"&Replace(fil,"'","''")&"')")
  If Not (sit.EOF) Then 
    Dim itm : Set itm = sit.Item
    itm.BPM = arr(3)
    itm.UpdateDB
  End If
Loop
Hope this helps! :)

Posted: Sun Jan 13, 2008 1:05 pm
by Big_Berny
Thanks a lot! That helped! :D

And another step to a perfect and complete library... :)

What a great forum...

Posted: Sun Jan 13, 2008 3:17 pm
by trixmoto
Glad I could help. :)

Posted: Sun Jan 13, 2008 5:16 pm
by m_bojangles
I'm in this same situation. Berny, can you post your complete script? Thanks.

Posted: Sun Jan 13, 2008 5:19 pm
by Big_Berny
Well here it didn't work directly so I imported the date into a custom field first and then into the BPM. But I can write a complete script if you want. Just need some days because I still have some exams...

Posted: Sun Jan 13, 2008 5:32 pm
by m_bojangles
I don't mind using your initial approach... I don't need anything elegant. So do you have a script for importing the BPM into a custom field?

Then did you use one of those cool "set a field to the value of another field" scripts I've seen floating around on here?

Thanks!

Posted: Sun Jan 13, 2008 5:36 pm
by Big_Berny
Well, I just have a temp.vbs-file which I always use for small temporary scripts. So I don't have the code anymore. But I'll post it soon!

Posted: Sat Jan 19, 2008 4:28 pm
by vanmeterannie
So, I'm new at this coding thing...will the above sections work pieced together, or is there more to it? I'd love to be able to extract the info as well, since I have all ape files - it'll be a bear to make mp3s of them and get the bpm from that, but I don't see another way around it, and I'd like to pull that data from the txt file.

Posted: Sun Jan 20, 2008 7:25 am
by trixmoto
If the "sections" means the 3 chunks of code I posted at the top, then you only need the last one. If you check them carefully, they are the same code but adding extra lines each time, as I was explaining each thing that I was doing.

This is a VERY rough-and-ready block of code, but it should be usable. :)

Posted: Mon Feb 25, 2008 10:55 pm
by mhendu
Has anyone worked out this script completely? I'd love to be able to import the BPM data from MixMeister but my scripting skills are meager. Thanks!

Posted: Mon Feb 25, 2008 11:05 pm
by spacefish
I'd be interested in this too!

Posted: Thu Apr 10, 2008 2:21 pm
by mhendu
Soooo - I'm sorry to keep asking but if anyone could help out with this script I'd really appreciate it. I don't know of any other way to easily get the BPMs imported for all my tracks and I'm sure others would find this to be useful also. Thanks!

Posted: Fri Apr 11, 2008 10:04 am
by newmomma
I don't know much about the whole code thing, but in order to import BPM into my library I just ran the songs on MixMeister and then highlighted the whole thing and dragged and dropped into my library. All tags were updated... I didn't bother saving as a text file 'cuz I couldn't figure out how to use it! Hope this is useful to someone :)

Posted: Fri Apr 11, 2008 11:27 am
by Big_Berny
@newmomma: Unfortunately this doesn't work for some songs - don't know why though...

Sorry, that I forgot to finish the script. I'll do that as soon as possible!