问题
So i had been trying to figure out how to upload the file on echonest servers for analysis but i am unable to,actually nothing happens after :Track track = echoNest.uploadTrack(file,true);
String[] args={"/storage/sdcard1/Music/Drive soundtrack/A Real Hero (feat. Electric Youth).mp3"};
File file = new File(args[0]);
if(!file.canRead())
{
printUsage();
System.out.println("Insert a valid path!");
}
System.out.println("validd path!");
EchoNestAPI echoNest = new EchoNestAPI("080NXJV4Y....");
System.out.println("hello!");
Track track = echoNest.uploadTrack(file,true);
System.out.println("uploaded!");
track.waitForAnalysis((60*1000)/2);
System.out.println("ID: "+track.getID());
System.out.println("Artist: "+track.getArtistName());
System.out.println("Title: "+track.getTitle());
I came across similar problems while searching over the internet but i couldn't come across a solution.
http://archive-com.com/page/3694036/2014-02-11/http://developer.echonest.com/forums/thread/365
http://developer1072.rssing.com/chan-22893681/all_p31.html#item617
http://developer.echonest.com/forums/thread/1624
here is the error I am receiving
08-17 02:27:28.555: I/System.out(2776): EchoNestAPI Error: java.net.UnknownHostException: Unable to resolve host "developer.echonest.com": No address associated with hostname cmd: http://developer.echonest.com/api/v4/track/profile?md5=2fff2dc89742ea6aadf89a96590a2174&api_key=080NXJV4YHVLIVBFA
08-17 02:27:28.555: I/System.out(2776): EchoNestAPI retry failure cmd: http://developer.echonest.com/api/v4/track/profile?md5=2fff2dc89742ea6aadf89a96590a2174&api_key=080NXJV4YHVLIVBFA
回答1:
It appears that your api key was invalid and your jar imports were conflicting with each other. You have to make sure you are making that call inside an AsyncTask
. After that, all is going to work ok.
来源:https://stackoverflow.com/questions/25343033/android-java-echonest-file-upload-errorrr