所以我一直在试图找出如何将文件上传到echonest服务器上进行分析,但是我却无法做到,实际上: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());
在Internet上搜索时遇到了类似的问题,但找不到解决方案。
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
这是我收到的错误
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
最佳答案
看来您的api密钥无效,并且jar导入彼此冲突。您必须确保在AsyncTask
中进行该调用。之后,一切都会正常进行。