Guest User

Untitled

a guest
Feb 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. - (void)connection:(CPURLConnection)aConnection didReceiveData:(CPString)data
  2. {
  3. CPLog(data);
  4. if (connection == aConnection)
  5. {
  6. CPLog("hr,,");
  7. try
  8. {
  9. // CPLog("Now");
  10. var result = CPJSObjectCreateWithJSON(data);
  11. CPLog(result);
  12. }
  13. catch(e)
  14. {
  15. //CPLog("Error");
  16. return [self connection:aConnection didFailWithError: e];
  17. }
  18.  
  19. // do stuff with result
  20. CPLog([result description]);
  21. var x;
  22. for(x in result)
  23. {
  24. // alert(result[x]["Name"]);
  25. var name = result[x]["Name"];
  26. var url = result[x]["playlist_tracks_url"];
  27. [self addPlaylist:url withName:name];
  28. }
  29. connection = nil;
  30. }
  31. if(playlistConnection == aConnection)
  32. {
  33. CPLog("playlist connection");
  34. try
  35. {
  36. CPLog("Now");
  37. var result = CPJSObjectCreateWithJSON(data);
  38. CPLog(result);
  39. }
  40. catch(e)
  41. {
  42. CPLog("Error");
  43. CPLog(e);
  44. return [self connection:aConnection didFailWithError: e];
  45. }
  46.  
  47. // do stuff with result
  48. CPLog([result description]);
  49. [libraryTable setModel:result];
  50.  
  51. libraryTableModel = result;
  52. if(artistTableViewEnabled)
  53. [self changeView:"Artists"];
  54.  
  55. 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";
  56. if(flashEnabled)
  57. [self changeView:"Coverflow"];
  58. playlistConnection = nil;
  59. }
  60. if(searchConection == aConnection)
  61. {
  62. CPLog("search connection");
  63. try
  64. {
  65. CPLog("Now");
  66. var result = CPJSObjectCreateWithJSON(data);
  67. CPLog(result);
  68. }
  69. catch(e)
  70. {
  71. CPLog("Error");
  72. CPLog(e);
  73. return [self connection:aConnection didFailWithError: e];
  74. }
  75.  
  76. [libraryTable setModel:result];
  77. searchConection = nil;
  78.  
  79. libraryTableModel = result;
  80. if(artistTableViewEnabled)
  81. [self changeView:"Artists"];
  82.  
  83. 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";
  84. if(flashEnabled)
  85. [self changeView:"Coverflow"];
  86. }
  87. //CPLog("Nope");
  88. }
Add Comment
Please, Sign In to add comment