Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // leave music_url blank if set in object's description
- string music_url = "";
- key HTTPRequest;
- string feed;
- string URL;
- string currSongTitle;
- string lastSongTitle;
- list feedList;
- default
- {
- state_entry()
- {
- llSetText(" ",<1,1,1>,1);
- llSetTimerEvent(5.0);
- if(music_url)
- {
- URL = music_url;
- } else {
- URL = llGetObjectDesc();
- }
- }
- timer()
- {
- HTTPRequest=llHTTPRequest(URL + "/7.html HTTP/1.0\nUser-Agent: LSL Script (Mozilla Compatible)\n\n",[],"");
- }
- http_response(key k,integer status, list meta, string body)
- {
- if(k != HTTPRequest) return;
- feed = llGetSubString(body,llSubStringIndex(body, "<body>") + llStringLength("<body>"), llSubStringIndex(body,"</body>") - 1);
- feedList = llParseString2List(feed,[","],[]);
- currSongTitle = llList2String(feedList,6);
- integer length = llGetListLength(feedList);
- if(llList2String(feedList,7))
- {
- integer a = 7;
- for(; a<length; ++a)
- {
- currSongTitle += ", " + llList2String(feedList,a);
- }
- }
- if (currSongTitle != lastSongTitle)
- {
- llSetText(currSongTitle,<1,1,1>,0.75);
- lastSongTitle = currSongTitle;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement