Last active
August 29, 2015 14:15
-
-
Save fotiDim/b4d7d32e5e5775bb26c5 to your computer and use it in GitHub Desktop.
Find all working Spotify genres.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Set these properties | |
@property NSMutableArray *genres; | |
@property int counter; | |
@property NSMutableArray *workingGenres; | |
//Set counter to 0 | |
_counter=0 | |
//Populate the "genres" array with the NSStrings of your genres | |
//call the method | |
[self lookupwithString:_genres[_counter]]; | |
-(void) lookupGenrewithString:(NSString*)genre{ | |
NSString *searchString = [[NSString alloc]initWithFormat:@"genre:\"%@\"",genre]; | |
_counter++; | |
[SPTRequest performSearchWithQuery:searchString queryType:SPTQueryTypeArtist session:_session market:@"from_token" callback:^(NSError *error, SPTListPage *listPage) { | |
if (error != nil) { | |
NSLog(@"*** Working Genre %@ Lookup got error %@", genre, error); | |
return; | |
} | |
if ([listPage.items count] > 0){ | |
NSLog(@"Added %@ to list",genre); | |
[_workingGenres addObject:genre]; | |
} | |
if (_counter >= [_genres count]) | |
NSLog(@"Working genres list: %@",[_workingGenres description]); | |
else | |
[self lookupGenrewithString:_genres[_counter]]; | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment