SHARE
TWEET

Untitled

a guest May 19th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     touch_start(integer rrr)    {
  27.         HTTPRequest=llHTTPRequest(URL + "/7.html HTTP/1.0\nUser-Agent: LSL Script (Mozilla Compatible)\n\n",[],"");
  28.     }
  29.  
  30.     http_response(key k,integer status, list meta, string body)
  31.     {
  32.         if(k != HTTPRequest) return;
  33.  
  34.         feed = llGetSubString(body,llSubStringIndex(body, "<body>") + llStringLength("<body>"), llSubStringIndex(body,"</body>") - 1);
  35.         feedList = llParseString2List(feed,[","],[]);
  36.         currSongTitle = llList2String(feedList,6);
  37.         integer length = llGetListLength(feedList);
  38.        
  39.         if(llList2String(feedList,7))
  40.         {
  41.             integer a = 7;
  42.             for(; a<length; ++a)
  43.             {
  44.                 currSongTitle += ", " + llList2String(feedList,a);
  45.             }
  46.         }
  47.          
  48.         if (currSongTitle != lastSongTitle)
  49.         {
  50.             llSetText(currSongTitle,<1,1,1>,0.75);
  51.             lastSongTitle = currSongTitle;
  52.         }
  53.     }
  54. }
RAW Paste Data
Top