Advertisement
Guest User

Untitled

a guest
Aug 8th, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. // leave music_url blank if set in object's description
  2. string music_url = "";
  3.  
  4. key HTTPRequest;
  5. string feed;
  6. string URL;
  7. string currSongTitle;
  8. string lastSongTitle;
  9. list feedList;
  10.  
  11. default
  12. {
  13. state_entry()
  14. {
  15. llSetText(" ",<1,1,1>,1);
  16. llSetTimerEvent(5.0);
  17.  
  18. if(music_url)
  19. {
  20. URL = music_url;
  21. } else {
  22. URL = llGetObjectDesc();
  23. }
  24. }
  25.  
  26. timer()
  27. {
  28. HTTPRequest=llHTTPRequest(URL + "/7.html HTTP/1.0\nUser-Agent: LSL Script (Mozilla Compatible)\n\n",[],"");
  29. }
  30.  
  31. http_response(key k,integer status, list meta, string body)
  32. {
  33. if(k != HTTPRequest) return;
  34.  
  35. feed = llGetSubString(body,llSubStringIndex(body, "<body>") + llStringLength("<body>"), llSubStringIndex(body,"</body>") - 1);
  36. feedList = llParseString2List(feed,[","],[]);
  37. currSongTitle = llList2String(feedList,6);
  38. integer length = llGetListLength(feedList);
  39.  
  40. if(llList2String(feedList,7))
  41. {
  42. integer a = 7;
  43. for(; a<length; ++a)
  44. {
  45. currSongTitle += ", " + llList2String(feedList,a);
  46. }
  47. }
  48.  
  49. if (currSongTitle != lastSongTitle)
  50. {
  51. llSetText(currSongTitle,<1,1,1>,0.75);
  52. lastSongTitle = currSongTitle;
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement