Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)connection:(CPURLConnection)aConnection didReceiveData:(CPString)data
- {
- CPLog(data);
- if (connection == aConnection)
- {
- CPLog("hr,,");
- try
- {
- // CPLog("Now");
- var result = CPJSObjectCreateWithJSON(data);
- CPLog(result);
- }
- catch(e)
- {
- //CPLog("Error");
- return [self connection:aConnection didFailWithError: e];
- }
- // do stuff with result
- CPLog([result description]);
- var x;
- for(x in result)
- {
- // alert(result[x]["Name"]);
- var name = result[x]["Name"];
- var url = result[x]["playlist_tracks_url"];
- [self addPlaylist:url withName:name];
- }
- connection = nil;
- }
- if(playlistConnection == aConnection)
- {
- CPLog("playlist connection");
- try
- {
- CPLog("Now");
- var result = CPJSObjectCreateWithJSON(data);
- CPLog(result);
- }
- catch(e)
- {
- CPLog("Error");
- CPLog(e);
- return [self connection:aConnection didFailWithError: e];
- }
- // do stuff with result
- CPLog([result description]);
- [libraryTable setModel:result];
- libraryTableModel = result;
- if(artistTableViewEnabled)
- [self changeView:"Artists"];
- flashURL = "Resources/itunesartV5.swf?action=CoverBrowser&DTXml=/flash.html%3Faction=flashsearch%26user=Guest%26pass=%26s1=" + escape(playlistName) + "%26Type=Playlist%26CoverBrowse=true%26size=small%26ftype=any%26limit=50%26offset=0%26foo=bar.xml";
- if(flashEnabled)
- [self changeView:"Coverflow"];
- playlistConnection = nil;
- }
- if(searchConection == aConnection)
- {
- CPLog("search connection");
- try
- {
- CPLog("Now");
- var result = CPJSObjectCreateWithJSON(data);
- CPLog(result);
- }
- catch(e)
- {
- CPLog("Error");
- CPLog(e);
- return [self connection:aConnection didFailWithError: e];
- }
- [libraryTable setModel:result];
- searchConection = nil;
- libraryTableModel = result;
- if(artistTableViewEnabled)
- [self changeView:"Artists"];
- flashURL = "Resources/itunesartV5.swf?action=CoverBrowser&DTXml=/flash.html%3Faction=flashsearch%26id=fva3hdtn%26s1=" + escape(searchQuery) + "%26Type=All%26CoverBrowse=true%26size=small%26ftype=any%26limit=50%26offset=0%26foo=bar.xml";
- if(flashEnabled)
- [self changeView:"Coverflow"];
- }
- //CPLog("Nope");
- }
Add Comment
Please, Sign In to add comment