Click here to Skip to main content
15,890,282 members
Articles / Operating Systems / Windows

Batch Uploading Music Files to Echo Nest

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
5 Oct 2016CPOL1 min read 10.2K   1  
Batch uploading music files to Echo Nest

This is in English for an international audience.

There is an interesting service called The Echo Nest that is a music API you can do a lot of interesting things with like The Count. But if you (like me) have music that is a bit outside the mainstream, there is the problem that they do not know about it. So I hacked together a simple package to upload mp3 files to their servers for analysis.

First you need:

Ok, my batch coding skills are very rusty, so please forgive me for this rather hackish solution.

I created the directory C:\CURLER and put curl.exe there. I also created two batch files.

One called CURLER.BAT as:

@echo off
echo %1
C:\curler\curl -X POST -H "Content-Type:application/octet-stream" 
"http://developer.echonest.com/api/v4/track/upload?api_key=YOUR_API_KEY&filetype=mp3" --data-binary @%1
timeout /t 2

Replace YOUR_API_KEY with the API key you got from the Dev Center.

This file takes the file name of an mp3 file and uploads it to Echo Nest's servers. It does not check if they already know about it (sorry about that, I'll try to make something better later).

Well, that works, but it is a bit tedious so I made another batch file I called ALLMP3.BAT and it looks like:

@echo off
FOR /R %1 %%G IN (*.mp3) do call C:\curler\curler.bat "%%G"

It takes a directory name as parameter and loops through that and all subdirectories of it and sends them.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Sweden Sweden
Born 1970. Not dead yet.

Comments and Discussions

 
-- There are no messages in this forum --