Jump to content

Change transparency of prims with the use of audio stream?


Jadey Whitefalcon
 Share

You are about to reply to a thread that has been inactive for 2490 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

  I don't really do scripting but I am a decorator. For personal use on my land I would like to use my audio stream to trigger prims to change from transparent to opaque and vice-versa through listening to the song name on an audio stream. For instance I will have animated rain textures that are placed all around that when the song says Storm or rain it will appear and when it says sunny it will disappear. Is there a way I can accomplish this? 

Thanks in advance for any help

Note: This is something I would like to be just very simple as far as scripts go just doing the function I said. It doesn't need to do anything else 

Edited by Jadey Whitefalcon
Added information
Link to comment
Share on other sites

I would think something like this would require each song title to be read somehow and checked for the strings that trigger the effects. You'd probably need to have the song titles you wanted in a notecard (or just a list) to check the strings against. I'm not exactly sure how to do this, and I've only had two cups of coffee so far... I am sooooooo not in my Google-ing zone yet. As for the effects themselves, there's plenty of ways of doing them. An animated texture on a prim backdrop, particle effects for weather, it's all doable.

If you're not a scripter, and don't intend to become one, and need something this personalized, I'd suggest looking in the employment forum for someone willing to help you out.

On the other hand, it might be something so simple that you can do it easily yourself, in which case you can expect to see about a dozen or so different ways of doing it as soon as everyone else wakes up and reads this thread. xD

Edited by Berksey
Link to comment
Share on other sites

this is an advanced script, because you have to determine what kind of stream is being used.

old style streams might use...
  HTTPRequest=llHTTPRequest(URL + "/7.html HTTP/1.0\nUser-Agent: LSL Script (Mozilla Compatible)\n\n",[],"");

while newer shoutcast one may use...

 llHTTPRequest(URL + "/stats?sid=1 HTTP/1.0\nUser-Agent: XML Getter (Mozilla Compatible)\n\n",

etc etc...

Quote

  I don't really do scripting

seems you need the employment forum, and it won't be cheap :|
 

  • Like 1
Link to comment
Share on other sites

That's an interesting idea, though not one that's going to be easy to implement.  There are certainly ways to scrape song titles from some music streams by parsing HTTP headers.  Matching those to keywords isn't hard either, except that you'd need to anticipate all of the possible variations of those words and also figure out how to tell your script that it's OK to identify the string "rain" in "Raindrops Keep Fallin' on My Head" but ignore it where "rain" is part of "brain", "drain", "strain", or "sprain".  Unfortunately, LSL was not designed to do big database manipulation.  It has neither the memory nor the speed that you'd need to do this well. You'd have to settle for a small scale version of your plan, I'm sure.

I wouldn't use animated textures for the weather, personally, because you can get much more pleasing effects with particles.  Doing it right takes a wee bit of magic, but I know a few scripters who can do amazing things with particles that make my own efforts look pitiful.

As Berksey says, the bottom line is that this isn't something you can do yourself unless you are an accomplished scripter.  If you want to hire an accomplished scripter, post in the InWorld Employment forum and be prepared to pay a good price.

Edited by Rolig Loon
  • Like 1
Link to comment
Share on other sites

I appreciate all the comments so far, I should prolly clarify some. I have control of my stream which would be Shoutcast, I was also talking about songs that specifically are named  "Rain" or "Sun" No other varients would be in there for song titles. I also have the rain im using for it that I made. The part that I need to be able to do is have the prims or single prim that can activate the other ones to  listening to the stream name to either be transparent or opaque. 

Link to comment
Share on other sites

17 minutes ago, Jadey Whitefalcon said:

I appreciate all the comments so far, I should prolly clarify some. I have control of my stream which would be Shoutcast, I was also talking about songs that specifically are named  "Rain" or "Sun" No other varients would be in there for song titles. I also have the rain im using for it that I made. The part that I need to be able to do is have the prims or single prim that can activate the other ones to  listening to the stream name to either be transparent or opaque. 

That simplifies things.  Be sure that you make that clear when you post in InWorld Employment, so that you get replies from scripters who have a good idea of the scope of the project.

Link to comment
Share on other sites

I don't script but I have a person who knows how to script. His only issue with making this work was he doesn't know exactly how to bridge the stream to a prim. . It wasn't something I was hoping to employ for it was more a question to help him figure it out. Thats why I posted here and not on the employment forums. If I have to do that later im all for that but this is more a question of what is this missing bridge. He basically wants to know if there is a way to read it using LSL or if he has to write it outside of SL.

Link to comment
Share on other sites

I understand.  If your friend has never done this before, he should spend some time studying the epic thread here >>> http://www.sluniverse.com/php/vb/scripting/32062-script-read-song-information-stream.html  .  It's not elementary stuff, and the details vary from one stream to another (and keep changing), but that thread should be enough to point out where the challenges are.

Link to comment
Share on other sites

You , or your friend may also take note of this thread:

Depending on which second life server version your region is currently running, the http request to receive the stream info has to be altered accordingly. On Tuesdays server deploy only the new request urls will work on the entire grid then. That is if nothing happens that would hold back the OS upgrade from being deployed again.

Edited by arton Rotaru
  • Like 1
Link to comment
Share on other sites

Quote

He basically wants to know if there is a way to read it using LSL or if he has to write it outside of SL.

 

A snippet example on using lsl to capture and parse an http body?

 

/*
Old style request :

 HTTPRequest=llHTTPRequest(URL + "/7.html HTTP/1.0\nUser-Agent: LSL Script (Mozilla Compatible)\n\n",[],"");

new style request:

HTTPRequestKey=llHTTPRequest(url + "/stats?sid=1 HTTP/1.0\nUser-Agent: XML Getter (Mozilla Compatible)\n\n",[],"");

** july - 2017
won't work with this script -
   string URL = "http://ice1.somafm.com/lush:80";
WORKING -
   string URL = "http://149.56.155.209:80";
*/

 

list StatusCodes =[
100,"Continue",
101,"Switching Protocols",
200,"OK",
201,"Created",
202, "Accepted",
203, "Non-Authoritative Information",
204, "No Content",
205, "Reset Content",
206, "Partial Content",
300, "Multiple Choices",
301, "Moved Permanently",
302, "Found",
303, "See Other",
304, "Not Modified",
305, "Use Proxy",
306, "(Unused)",
307, "Temporary Redirect",
400, "Bad Request",
401, "Unauthorized",
402, "Payment Required",
403, "Forbidden",
404, "Not Found",
405, "Method Not Allowed",
406, "Not Acceptable",
407, "Proxy Authentication Required",
408, "Request Timeout",
409, "Conflict",
410, "Gone",
411, "Length Required",
412, "Precondition Failed",
413, "Request Entity Too Large",
414, "Request-URI Too Long",
415, "Unsupported Media Type",
416, "Requested Range Not Satisfiable",
417, "Expectation Failed",
500, "Internal Server Error",
501, "Not Implemented",
502, "Bad Gateway",
503, "Service Unavailable",
504, "Gateway Timeout",
505, "HTTP Version Not Supported"];

string Genre;
string SongTitle;
string URL = "http://149.56.155.209:80";
key HTTPRequestKey;
default
{   
    state_entry()
    {
    }
    touch_start(integer total_number)
    {   HTTPRequestKey =
        llHTTPRequest(URL + "/stats?sid=1 HTTP/1.0\nUser-Agent: XML Getter (Mozilla Compatible)\n\n",
         [HTTP_METHOD, "GET",
         HTTP_MIMETYPE, "text/application/xml;charset=utf-8",
         HTTP_BODY_MAXLENGTH,16384,
         HTTP_PRAGMA_NO_CACHE,TRUE], "");
    }  
    http_response(key k,integer status, list meta, string body)
    {    if(k != HTTPRequestKey)
        {   llSay(0," nope");
            return;  
        }
         if(status != 200)
               { integer index = llListFindList(StatusCodes, [status]);
                 string msg = llList2String(StatusCodes,index+1);
                 llOwnerSay("\nStatus; " + (string)status + "\nCode: " + msg );
                 return;     
              }
        else     
       {  list my_list = llParseString2List(body,["><","</"],[""]);     
           integer index1 = llListFindList(my_list, ["SERVERGENRE"]);
           Genre = llList2String(my_list,index1 -1);
           Genre = llGetSubString(Genre, 12, -1);
           integer index2 = llListFindList(my_list, ["SONGTITLE"]);
           SongTitle =  llList2String(my_list,index2 -1);
           SongTitle =  llGetSubString(SongTitle, 10, -1);           
           llOwnerSay(" got \n" + Genre + " \n" + SongTitle); // for debug
       }    
    }
}

Edited by Xiija
  • Like 2
Link to comment
Share on other sites

  • Lindens

A heads up.  

Do not use

On 7/16/2017 at 9:49 PM, Xiija said:

/*
Old style request :

 HTTPRequest=llHTTPRequest(URL + "/7.html HTTP/1.0\nUser-Agent: LSL Script (Mozilla Compatible)\n\n",[],"");

new style request:

HTTPRequestKey=llHTTPRequest(url + "/stats?sid=1 HTTP/1.0\nUser-Agent: XML Getter (Mozilla Compatible)\n\n",[],"");

*/

 

In both of those cases llHTTPRequest will throw errors to the debug console and reject the HTTP request.  The culprit being the "\n"s in the URL..

Instead construct your URL request as follows:

Quote

HTTPRequestKey = llHTTPRequest( url + "/7.html", [ HTTP_USER_AGENT, "LSL_Script (Mozilla Compatible)" ], "");

or

HTTPRequestKey = llHTTPRequest( url + "/stats?sid=1", [ HTTP_USER_AGENT, "LSL_Script (Mozilla Compatible)" ], "");

Please see llHTTPRequest Documentation.

For a discussion of the issue see this thread:

https://community.secondlife.com/forums/topic/406941-dj-board-display-not-working-properly/

  • Like 6
Link to comment
Share on other sites

pleh, i used the new stuff and now i get

Status; 403
Code: Forbidden

it's so strange how such a popular thing as streaming music is SO arcane.

I search the web and forums, and no one seems to have any decent info on

how to do something so simple.

anyhoo, ::shrugs::

 

Link to comment
Share on other sites

 

@Xiija: a 403 at least shows your request is getting through, it's just being evaluated by the server on the other end in such a way as to forbid you access. I used to provide automatic hotlinking protection for people I hosted on my server, with the end result being similar when they tried to do legitimate things and the server thought it should call a foul. That's when I learned that GOATSE isn't something you want your clients to end up seeing just because they tried to embed an upload in an iframe or whatever... <-<;

Perhaps the server you're trying to contact thinks something's dodgy about the request, I'd try a few different ones to make sure. There's also a chance that because it's a different request format now the server simply doesn't realize it's legit.

And yeah, I agree. Simple things shouldn't be so derned difficult.

Edited by Berksey
Link to comment
Share on other sites

With the changes LL made, it's not guaranteed that everything that worked before will still be working. It could still be that your request header is too long for the server. Try to shorten "LSL_Script" to something like Radio, or Stream, and see if that makes a difference already.

Edit to add: Just did a quick test, and it looks like it doesn't like the word "Script". :SwingingFriends:

Edited by arton Rotaru
  • Like 1
Link to comment
Share on other sites

testing a Stream Titler a bit, seems to work with Shoutcast, Icecast, Soma, and 7.html?

anyhoo, pop it in a box and touch it, change the streams in the script etc... i'm just looking for feedback :)

 will do a full FP version in library with notecard reader if y'all think it's worth it :P

** the soma streams i test are the direct link ones...

"http://ice1.somafm.com/secretagent-128-mp3"

_________________________________

list StatusCodes =[
100,"Continue",
101,"Switching Protocols",
200,"OK",
201,"Created",
202, "Accepted",
203, "Non-Authoritative Information",
204, "No Content",
205, "Reset Content",
206, "Partial Content",
300, "Multiple Choices",
301, "Moved Permanently",
302, "Found",
303, "See Other",
304, "Not Modified",
305, "Use Proxy",
306, "(Unused)",
307, "Temporary Redirect",
400, "Bad Request",
401, "Unauthorized",
402, "Payment Required",
403, "Forbidden",
404, "Not Found",
405, "Method Not Allowed",
406, "Not Acceptable",
407, "Proxy Authentication Required",
408, "Request Timeout",
409, "Conflict",
410, "Gone",
411, "Length Required",
412, "Precondition Failed",
413, "Request Entity Too Large",
414, "Request-URI Too Long",
415, "Unsupported Media Type",
416, "Requested Range Not Satisfiable",
417, "Expectation Failed",
488, "Client closed request",
500, "Internal Server Error",
501, "Not Implemented",
502, "Bad Gateway",
503, "Service Unavailable",
504, "Gateway Timeout",
505, "HTTP Version Not Supported"];

string url;
string URL;
string URL2;
string URL3 = "http://indiespectrum.com:9000";
string URL4 ;
string URL5 ;
string URL6 ;
string URL7 = "http://ice1.somafm.com/secretagent-128-mp3"; 
string URL8  = "http://bigdaddys.digistream.info:20368" ;
string URL9 ;
string URL10 = "http://www.ebm-radio.org:7000";
string URL11 = "http://74.208.197.50:8087";
string URL12 = "http://radio.108.pl:8004";
string URL13 ;
string URL14;
string URL15 ;

key HTTPRequest;
key  XMLRequest;
string feed;
string xml = "/stats?sid=1";
string htp = "/7.html";
string somas = "/index.html";
string tag = "/played.html";
string currSongTitle;
string lastSongTitle;
list feedList;
string oldsong;
list chunk;
string Curr;

integer ISsoma;
string artist;
string song;
string album;

integer debug;
default
{
    state_entry()
    {   url = URL10;  // change this to test different types of streams above ... i. e.  url = URL10;
   
    }

    touch_start(integer total_number)
    {     llOwnerSay("sending request...");  // Soma check
    
          integer x;
          x = llSubStringIndex( url, "-128-mp3");
          if( x !=  -1 )
          {  url = llDeleteSubString( url, x , -1);    
             url += "/songhistory.html";           
             integer y;
             y =  llSubStringIndex( url, "ice1.");
             url = llDeleteSubString( url, y , y +  llStringLength( "ice1."   ) -1 );             
             ISsoma = 1;
          }              
          if(ISsoma)
          {  XMLRequest =
             llHTTPRequest( url , [HTTP_USER_AGENT, "XML-Getter/1.0 (Mozilla Compatible)",
             HTTP_METHOD, "GET", 
             HTTP_MIMETYPE,"text/application/xml;charset=utf-8", 
             HTTP_BODY_MAXLENGTH,16384,
             HTTP_PRAGMA_NO_CACHE,TRUE], "");    
             ISsoma = 0;
             return;  
          }
             XMLRequest =
             llHTTPRequest( url + xml, [HTTP_USER_AGENT, "XML-Getter/1.0 (Mozilla Compatible)",
             HTTP_METHOD, "GET", 
             HTTP_MIMETYPE,"text/application/xml;charset=utf-8", 
             HTTP_BODY_MAXLENGTH,16384,
             HTTP_PRAGMA_NO_CACHE,TRUE], "");      
           
    }   
    http_response(key k,integer status, list meta, string body)
    { 
        if(k ==  XMLRequest)   
        {  
            if(status != 200)
            {  llOwnerSay("error code\n");
               integer index = llListFindList(StatusCodes, [status]);
               string msg = llList2String(StatusCodes,index+1);
               llOwnerSay("\nStatus; " + (string)status + "\nCode: " + msg );
               return;   
            }
            else     
            { 
               if( ISsoma )  // Soma HACK
               {
                    string playing =  llGetSubString(body,llSubStringIndex(body, "<!-- line 1 -->") + llStringLength("<!-- line 1 -->"), llSubStringIndex(body,"<!-- line 2 -->") -1); 
                    playing = llUnescapeURL( playing );     
                    playing = llDeleteSubString(playing , 0 , llSubStringIndex(playing,"<a")  + llStringLength("<a") - 1 );   
                    playing = llDeleteSubString(playing , 0 , llSubStringIndex(playing,">")  + llStringLength(">") - 1 );   
                    artist =   llGetSubString(playing, 0, llSubStringIndex(playing, "</a>" )  -1 );
                   
                    playing = llDeleteSubString(playing , 0 , llSubStringIndex(playing,"<td>")  + llStringLength("<td>") - 1 ); 
                    song =   llGetSubString(playing, 0, llSubStringIndex(playing, "</td>" )  -1 );
                 
                    playing = llDeleteSubString(playing , 0 , llSubStringIndex(playing,"<a")  + llStringLength("<a") - 1 );  
                    playing = llDeleteSubString(playing , 0 , llSubStringIndex(playing,">")  + llStringLength(">") - 1 ); 
                    album =   llGetSubString(playing, 0, llSubStringIndex(playing, "</a>" )  -1 );                        
                 
                    llSetText( "\nArtist: " + artist + "\nSong: " + song + " \nAlbum: " + album, <0,1,0>,1.0);
                    ISsoma = 0;
                    return;  
               }
            
                integer invalid = llSubStringIndex(body, "<meta http-equiv");  //works for indie spectrum ?.... if /stats?sid=1 doesn't work, try 7.html call
                integer invalid2 = llSubStringIndex(body, "Invalid resource");
                if( invalid != -1 || invalid2 != -1 )
                 {   llOwnerSay("invalidated ...trying 7.html");
                     HTTPRequest =
                     llHTTPRequest( url + "/7.html", [HTTP_USER_AGENT, "XML-Getter/1.0 (Mozilla Compatible)",
                     HTTP_METHOD, "GET", 
                     HTTP_MIMETYPE,  "text/application/xml;charset=utf-8",  //  "text/application/xml;charset=utf-8",
                     HTTP_BODY_MAXLENGTH,16384,
                     HTTP_PRAGMA_NO_CACHE,TRUE], "");  ;
                     return;
                 }  
                
               string ver;            // SHOUTcast version syntax -  2.5.1.724 (posix(linux x64)) , ... 2.2.1.109 (win32)
               string version =  llGetSubString(body,llSubStringIndex(body, "<VERSION>") + llStringLength("<VERSION>"), llSubStringIndex(body,"</VERSION>>") -1);  
                if( llGetSubString( version, 0,0 ) == "2") { ver = "2"; }
               //    llOwnerSay("vers - " + ver);  DEBUG for version changes              
               string Genre =     llGetSubString(body,llSubStringIndex(body, "<SERVERGENRE>") + llStringLength("<SERVERGENRE>"), llSubStringIndex(body,"</SERVERGENRE>") -1);  
               string server =  llGetSubString(body,llSubStringIndex(body, "<SERVERTITLE>") + llStringLength("<SERVERTITLE>"), llSubStringIndex(body,"</SERVERTITLE>") -1);  
               string SongTitle = llGetSubString(body,llSubStringIndex(body, "<SONGTITLE>") + llStringLength("<SONGTITLE>"), llSubStringIndex(body,"</SONGTITLE>") -1);              
               llSetText( "\nGenre: " + Genre + "\nStation: " + server + " \nSong Title: " + SongTitle, <0,1,0>,1.0);
           }  
        } 
        if(k ==   HTTPRequest)   // 7.html HACK
        {   // llOwnerSay(" 7html \n" + body);
            list tmp = llCSV2List(body);
            string cap = llList2String(tmp,6);
            string by =  llGetSubString(cap, 0, llSubStringIndex(cap, "-" )  -1 );
            string sang = llGetSubString(cap,  llSubStringIndex(cap, "-") + 1,   llSubStringIndex(cap, "</body>") -1);
            llSetText("Artist : " + by + "\nSong : " + sang, <0,1,0>,1.0);
        } 
    }
}

 

Edited by Xiija
Link to comment
Share on other sites

  • Lindens
10 hours ago, Xiija said:

HTTP_MIMETYPE,"text/application/xml;charset=utf-8",

You will want to fix this line.  "text/application/xml" is not a valid mime type and in a roll coming very soon we will be validating this value for formatting.  A valid value will be in the form "type/subtype[;charset=utf-8".  The examples on the wiki were incorrect but have been updated.

  • Like 1
Link to comment
Share on other sites

the changed script for testing ... not sure if there are any stream types i'm missing?

Quote

these boards really need a cancel button

list StatusCodes =[
100,"Continue",
101,"Switching Protocols",
200,"OK",
201,"Created",
202, "Accepted",
203, "Non-Authoritative Information",
204, "No Content",
205, "Reset Content",
206, "Partial Content",
300, "Multiple Choices",
301, "Moved Permanently",
302, "Found",
303, "See Other",
304, "Not Modified",
305, "Use Proxy",
306, "(Unused)",
307, "Temporary Redirect",
400, "Bad Request",
401, "Unauthorized",
402, "Payment Required",
403, "Forbidden",
404, "Not Found",
405, "Method Not Allowed",
406, "Not Acceptable",
407, "Proxy Authentication Required",
408, "Request Timeout",
409, "Conflict",
410, "Gone",
411, "Length Required",
412, "Precondition Failed",
413, "Request Entity Too Large",
414, "Request-URI Too Long",
415, "Unsupported Media Type",
416, "Requested Range Not Satisfiable",
417, "Expectation Failed",
488, "Client closed request",
500, "Internal Server Error",
501, "Not Implemented",
502, "Bad Gateway",
503, "Service Unavailable",
504, "Gateway Timeout",
505, "HTTP Version Not Supported"];

string url;
string URL;
string URL2;
string URL3 = "http://indiespectrum.com:9000";
string URL4 ;
string URL5 ;
string URL6 ;
string URL7 = "http://ice1.somafm.com/secretagent-128-mp3"; 
string URL8  = "http://bigdaddys.digistream.info:20368" ;
string URL9 ;
string URL10 = "http://www.ebm-radio.org:7000";
string URL11 = "http://74.208.197.50:8087";
string URL12 = "http://radio.108.pl:8004";
string URL13 ;
string URL14;
string URL15 ;

key HTTPRequest;
key  XMLRequest;
string feed;
string xml = "/stats?sid=1";
string htp = "/7.html";
string somas = "/index.html";
string tag = "/played.html";
string currSongTitle;
string lastSongTitle;
list feedList;
string oldsong;
list chunk;
string Curr;

integer ISsoma;
string artist;
string song;
string album;

integer debug;
default
{
    state_entry()
    {   url = URL7; 
       // change this to test different types of streams above ... i. e.  url = URL10;   
    }
    touch_start(integer total_number)
    {     llOwnerSay("sending request...");  // Soma check
    
          integer x;
          x = llSubStringIndex( url, "-128-mp3");
          if( x !=  -1 )
          {  url = llDeleteSubString( url, x , -1);    
             url += "/songhistory.html";           
             integer y;
             y =  llSubStringIndex( url, "ice1.");
             url = llDeleteSubString( url, y , y +  llStringLength( "ice1."   ) -1 );             
             ISsoma = 1;
          }              
          if(ISsoma)
          {  XMLRequest =
             llHTTPRequest( url , [HTTP_USER_AGENT, "XML-Getter/1.0 (Mozilla Compatible)",
             HTTP_METHOD, "GET", 
             HTTP_MIMETYPE,  "application/xml;charset=utf-8", 
             HTTP_BODY_MAXLENGTH,16384,
             HTTP_PRAGMA_NO_CACHE,TRUE], "");               
             return;  
          }
             XMLRequest =
             llHTTPRequest( url + xml, [HTTP_USER_AGENT, "XML-Getter/1.0 (Mozilla Compatible)",
             HTTP_METHOD, "GET", 
             HTTP_MIMETYPE,"application/xml;charset=utf-8", 
             HTTP_BODY_MAXLENGTH,16384,
             HTTP_PRAGMA_NO_CACHE,TRUE], "");      
           
    }   
    http_response(key k,integer status, list meta, string body)
    { 
        if(k ==  XMLRequest)   
        {  
            if(status != 200)
            {  llOwnerSay("error code\n");
               integer index = llListFindList(StatusCodes, [status]);
               string msg = llList2String(StatusCodes,index+1);
               llOwnerSay("\nStatus; " + (string)status + "\nCode: " + msg );
               return;   
            }
            else     
            { 
               if( ISsoma )  // Soma HACK
               {
                    string playing =  llGetSubString(body,llSubStringIndex(body, "<!-- line 1 -->") + llStringLength("<!-- line 1 -->"), llSubStringIndex(body,"<!-- line 2 -->") -1); 
                    playing = llUnescapeURL( playing );     
                    playing = llDeleteSubString(playing , 0 , llSubStringIndex(playing,"<a")  + llStringLength("<a") - 1 );   
                    playing = llDeleteSubString(playing , 0 , llSubStringIndex(playing,">")  + llStringLength(">") - 1 );   
                    artist =   llGetSubString(playing, 0, llSubStringIndex(playing, "</a>" )  -1 );
                   
                    playing = llDeleteSubString(playing , 0 , llSubStringIndex(playing,"<td>")  + llStringLength("<td>") - 1 ); 
                    song =   llGetSubString(playing, 0, llSubStringIndex(playing, "</td>" )  -1 );
                 
                    playing = llDeleteSubString(playing , 0 , llSubStringIndex(playing,"<a")  + llStringLength("<a") - 1 );  
                    playing = llDeleteSubString(playing , 0 , llSubStringIndex(playing,">")  + llStringLength(">") - 1 ); 
                    album =   llGetSubString(playing, 0, llSubStringIndex(playing, "</a>" )  -1 );                        
                 
                    llSetText( "\nArtist: " + artist + "\nSong: " + song + " \nAlbum: " + album, <0,1,0>,1.0);
                    ISsoma = 0;
                    return;  
               }
            
                integer invalid = llSubStringIndex(body, "<meta http-equiv");  //. if /stats?sid=1 doesn't work, try 7.html call
                integer invalid2 = llSubStringIndex(body, "Invalid resource");
                if( invalid != -1 || invalid2 != -1 )
                 {   llOwnerSay("invalidated ...trying 7.html");
                     HTTPRequest =
                     llHTTPRequest( url + "/7.html", [HTTP_USER_AGENT, "XML-Getter/1.0 (Mozilla Compatible)",
                     HTTP_METHOD, "GET", 
                     HTTP_MIMETYPE, "text/plain;charset=utf-8", 
                     HTTP_BODY_MAXLENGTH,16384,
                     HTTP_PRAGMA_NO_CACHE,TRUE], "");  ;
                     return;
                 }  
                
               string ver;   // SHOUTcast version syntax -  2.5.1.724 (posix(linux x64)) , ... 2.2.1.109 (win32)
               string version =  llGetSubString(body,llSubStringIndex(body, "<VERSION>") + llStringLength("<VERSION>"), llSubStringIndex(body,"</VERSION>>") -1);  
                if( llGetSubString( version, 0,0 ) == "2") { ver = "2"; }
               //    llOwnerSay("vers - " + ver);  DEBUG for version changes              
               string Genre =     llGetSubString(body,llSubStringIndex(body, "<SERVERGENRE>") + llStringLength("<SERVERGENRE>"), llSubStringIndex(body,"</SERVERGENRE>") -1);  
               string server =  llGetSubString(body,llSubStringIndex(body, "<SERVERTITLE>") + llStringLength("<SERVERTITLE>"), llSubStringIndex(body,"</SERVERTITLE>") -1);  
               string SongTitle = llGetSubString(body,llSubStringIndex(body, "<SONGTITLE>") + llStringLength("<SONGTITLE>"), llSubStringIndex(body,"</SONGTITLE>") -1);              
               llSetText( "\nGenre: " + Genre + "\nStation: " + server + " \nSong Title: " + SongTitle, <0,1,0>,1.0);
           }  
        } 
        if(k ==   HTTPRequest)   // 7.html HACK
        {  
            list tmp = llCSV2List(body);
            string cap = llList2String(tmp,6);
            string by =  llGetSubString(cap, 0, llSubStringIndex(cap, "-" )  -1 );
            string sang = llGetSubString(cap,  llSubStringIndex(cap, "-") + 1,   llSubStringIndex(cap, "</body>") -1);
            llSetText("Artist : " + by + "\nSong : " + sang, <0,1,0>,1.0);
        } 
    }
}

 

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2490 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...