Skip to content

Instantly share code, notes, and snippets.

@grav
Created April 26, 2013 17:04
Show Gist options
  • Save grav/5468757 to your computer and use it in GitHub Desktop.
Save grav/5468757 to your computer and use it in GitHub Desktop.
One way of getting all tracks for an artist with the Cocoa Spotify API! Oh lawd ...
NSURL *artistUrl = [NSURL URLWithString:AebersoldSpotifyUri];
[SPArtistBrowse browseArtistAtURL:artistUrl inSession:[SPSession sharedSession] type:SP_ARTISTBROWSE_NO_TRACKS callback:^(SPArtistBrowse *artistBrowse) {
[SPAsyncLoading waitUntilLoaded:artistBrowse timeout:10.0 then:^(NSArray *loaded, NSArray *notLoaded) {
for(SPAlbum *a in artistBrowse.albums){
[SPAlbumBrowse browseAlbumAtURL:a.spotifyURL inSession:[SPSession sharedSession] callback:^(SPAlbumBrowse *albumBrowse) {
[SPAsyncLoading waitUntilLoaded:albumBrowse timeout:10.0 then:^(NSArray *loadedItems, NSArray *notLoadedItems) {
for(SPTrack *t in albumBrowse.tracks){
NSLog(@"%@",t);
}
}];
}];
}
}];
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment