PhiLho, thanks for the reply.
I´m working with the lastFm, json reply. I printed the response for Artist.gettopAlbums and its OK, but
I want to use the getPlaycount response for doing circles, lines an so on..
The json structure response is the following:
Album[name='The Best of David Bowie 1969/1974', id='null', url='http://www.last.fm/music/David+Bowie/The+Best+of+David+Bowie+1969%2F1974', mbid='',
playcount=13940, listeners=-1,
This what I have so for
- // last.fm api key
- String api_key = " my api key";
- import de.umass.lastfm.*;
-
- import java.util.Collection;
-
- Collection<Track> topTracks;
- Iterator<Track> tracks;
- Collection<Album> topAlbums;
- Iterator<Album> albums;
- int i = 0;
- String playcount = " " + i;
- /*
- // Track data
- Track track;
- Track b;
- String track_name;
- int track_playcount;*/
-
- void setup()
- {
- size(500,500);
-
- String artist = "David Bowie"; // store the name of the artist as a string
-
- topAlbums = Artist.getTopAlbums(artist, api_key); // request the top albums from last fm
- albums = topAlbums.iterator(); // create an iterator over the elements in topAlbums
- topTracks = Artist.getTopTracks(artist, playcount, api_key); // request the top tracks from last fm
-
- tracks = topTracks.iterator();
-
- println(topAlbums);
-
- background(102);
- fill(204);
- text("Press spacebar...",200,200);
- }
-
- void draw()
- {
- //getTrackInfo(b.getPlays(),b.getName());
- }
- /*void getTrackInfo (String ar, int play){
- //get the track as a Track object
- track = Track.getInfo(ar,plays,api_key);
- track_name = track.getName(); //get track name
- track_playcount = track.getplays(); //get track plays
- }*/
-
- void keyPressed() {
- if (key == 32) // if that key is a spacebar
- {
- PImage cover; // declare a PImage to hold album covers
- Album a;
-
- background(102); // clear the window and set the background to a nice grey
-
- if (albums.hasNext())
- {
- a = albums.next(); // get the next album from the iterator and store it in 'a'
-
- fill(204); // set the fill to a lighter grey
- text(a.getName(), 50, 50); // print the album name at (50,50)
-
- // retrieve the album cover image and store it in 'cover'
- cover = loadImage(a.getImageURL(ImageSize.valueOf("EXTRALARGE")));
-
- // display the album cover
- image(cover, 100, 100);
- }
- }
- }