SHOW:
|
|
- or go back to the newest paste.
| 1 | // | |
| 2 | // - performSearchOperation: | |
| 3 | // | |
| 4 | - (void) performSearchOperation:(HGSCallbackSearchOperation *)operation | |
| 5 | {
| |
| 6 | HGSQuery * query = [operation query]; | |
| 7 | NSString * queryString = [[query tokenizedQueryString] originalString]; | |
| 8 | ||
| 9 | if (!(search_ = [[JKPSpotifySearch alloc] initWithQuery:queryString])) | |
| 10 | {
| |
| 11 | [operation finishQuery]; | |
| 12 | return; | |
| 13 | } | |
| 14 | ||
| 15 | [search_ beginSearchWithCompletionHandler: | |
| 16 | ^(NSDictionary * results, NSError * error) | |
| 17 | {
| |
| 18 | if ([operation isCancelled]) | |
| 19 | return; | |
| 20 | ||
| 21 | if (error != nil) | |
| 22 | NSLog(@"Spotify query failed: %@", | |
| 23 | [[error userInfo] valueForKey:kJKPSpotifySearchErrorReasonKey]); | |
| 24 | else | |
| 25 | [operation setRankedResults:[self processResults:results | |
| 26 | forQuery:query]]; | |
| 27 | [operation finishQuery]; | |
| 28 | }]; | |
| 29 | } |