INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Import BPM values  (Read 1800 times)

vbphil

  • World Citizen
  • ***
  • Posts: 136
Import BPM values
« on: May 28, 2022, 09:31:46 am »

MC's BPM values are not correct. I've found a website, SongBPM.com that appears to have pretty good BPM values. I'd like to import their values into my Library.
So far, I've created a new Library Field, BPMA. I look up a song in SongBPM.com and enter their value into that field. This will take forever.
SongBPM.com is developing a Pro subscription version that will have an API. I believe I can create a Windows program to take a list of my songs and get the BPM value thru their API.

My question is, how can I then import those BPM values into the User Field I created in MC?
Logged

vbphil

  • World Citizen
  • ***
  • Posts: 136
Re: Import BPM values
« Reply #1 on: May 30, 2022, 11:58:15 am »

I've found another website that provides an API to look up songs and get their BPM. It also provides the time signature and music key.
https://getsongbpm.com/api

I've finished writing a Win Desktop app that looks up BPM, time_sig and key_of information. I have a subset of 3000 songs that I need to upload this information into my MC Library. Still needing to know how to do that. the search goes on.
Logged

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14463
  • I won! I won!
Re: Import BPM values
« Reply #2 on: May 30, 2022, 04:29:44 pm »

Swag of Tools should do what you want.  See the bit on Data Fiddler.
Logged
JRiver CEO Elect

vbphil

  • World Citizen
  • ***
  • Posts: 136
Re: Import BPM values
« Reply #3 on: May 30, 2022, 07:40:58 pm »

I like to use the Export Playlist and choose CSV file to get the list of songs that I want to update. However, I'm stuck on getting the Database Key for each of the files. Is there not a way to include that in the Export?
Logged

vbphil

  • World Citizen
  • ***
  • Posts: 136
Re: Import BPM values
« Reply #4 on: May 30, 2022, 08:21:49 pm »

I'll answer my own question. You can create a User Library Field and choose a Calculated Data Expression and choose FileKey(). So now in my Playlist that I use for Export I can include the FileKey and then use that value when updating the Library thru the MC API REST interface.

SetInfo
         Set information about a file object.
         Parameters:
            File: The key of the file. (default: -1)
            FileType: The type of value provided in 'File' (Key: file key; Filename: filename of file). (default: Key)
            Field: The field to set. (default: )
            Value: The value to set the field to. (default: )
            List: Set to 'CSV' and comma delimit (RFC 4180) the field and value to set multiple values in one call. (default: )
            Formatted: Set to 1 if you're passing a formatted value (like a formatted date). (default: 1)
         Response:
         Examples:
            Click here

This is an example URL to update File 343079 with Tempo value.

http://192.168.1.100:52199/MCWS/v1/File/SetInfo?File=343079&FileType=Key&Field=tempo&Value=100&Formatted=1

You also have to authenticate with username and password. That can be done by getting a token.

Authenticate
      Simple query to test and establish authentication.
      Response:
         Token: The token that can be appended to calls in place of HTTP authentication.
         ReadOnly: Whether the token is for read-only access. If not present or false, the token has full rights.
         PreLicensed: True if MC is running in restricted mode
      Examples:
         Click here

http://192.168.1.100:52199/MCWS/v1/Authenticate
<Response Status="OK">
<Item Name="Token">2Kb7FzP5</Item>
<Item Name="ReadOnly">0</Item>
<Item Name="PreLicensed">0</Item>
</Response>
Logged
Pages: [1]   Go Up