Playlist Generator  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
Playlist2/SpotifyURILookup.m
Go to the documentation of this file.
00001 //
00002 //  SpotifyURILookup.m
00003 //  This class takes the name of a track and artist and finds
00004 //  a list of tracks on the spotify library. 
00005 //
00006 //  Created by Max Woolf on 15/12/2011.
00007 //  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
00008 //
00009 
00010 #import "SpotifyURILookup.h"
00011 
00012 @implementation SpotifyURILookup
00013 //Create a new SpotifyURILookup object.
00014 //Assign a track and artist name.
00015 -(id)initWithTrackName:(NSString *)track artistName:(NSString *)artist delegate:(id)delegate
00016 {
00017     artistName = artist;
00018     trackName = track;
00019     self = [super initWithRequest:[self getSpotifyURIRequest] delegate:delegate];
00020     return self;
00021 }
00022 
00023 -(NSURLRequest *)getSpotifyURIRequest
00024 {
00025     NSString *requestString = [[[NSString alloc] initWithFormat:@"http://ws.spotify.com/search/1/track.json?q=artist:%@ AND track:%@", artistName, trackName] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
00026     NSLog(@"%@", requestString);
00027     NSURL *requestURL = [[NSURL alloc] initWithString:requestString];
00028     return [[NSURLRequest alloc] initWithURL:requestURL];
00029 }
00030 @end