Quantcast
Channel: The Echo Nest Developer Forum
Viewing all articles
Browse latest Browse all 1582

foreign ids on tracks (jEN)

$
0
0

Hi, I'm trying to obtain foreign ids from tracks (in a playlist) using the java library

I tried this example:

PlaylistParams params = new PlaylistParams(); params.addIDSpace("id:rdio-US"); params.addArtist("spice girls"); params.addArtist("green day"); params.includeTracks(); params.setLimit(true);

    Playlist playlist = en.createStaticPlaylist(params);

    for (Song song : playlist.getSongs()) {
        Track track = song.getTrack("spotify-WW");
        System.out.println(track.getForeignID() + "" + song.getTitle() + " by " + song.getArtistName());
    }

However, I get this error

Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map at com.echonest.api.v4.ENItem.extractForeignIDs(ENItem.java:159) at com.echonest.api.v4.ENItem.refresh(ENItem.java:80) at com.echonest.api.v4.Track.getStatus(Track.java:75) at com.echonest.api.v4.Track.getTopLevelItem(Track.java:166) at com.echonest.api.v4.Track.getForeignID(Track.java:153) at intelligence.TestArtistEchonest.main(TestArtistEchonest.java:29)

Does anyone know a workaround for this without having to do several calls to the API?


Viewing all articles
Browse latest Browse all 1582

Trending Articles