Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

Batch uploading music files to Echo Nest

, 28 Jan 2014
Rate this:
Please Sign up or sign in to vote.
This is in English for an international audience.There is an interesting service celled 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
This is in English for an international audience.

There is an interesting service celled 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 trough 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)

Share

About the Author

staffan_v
Software Developer
Sweden Sweden
Born 1970. Not dead yet.
Follow on   Google+

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 28 Jan 2014
Article Copyright 2014 by staffan_v
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid