Shoutbox

Now playing - XML Document - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Now playing - XML Document (/showthread.php?tid=94649)

Now playing - XML Document by carllawl on 05-25-2010 at 06:00 PM

Is it possible to get the current song from from an XML document and post it to a user when they type !current

XML file is: http://69.175.111.66:8301/admin.cgi?mode=viewxml

i am aware the xml has a user and password

but i need the field <songtitle>

the xml looks like this

code:
<SHOUTCASTSERVER>
<CURRENTLISTENERS>24</CURRENTLISTENERS>
<PEAKLISTENERS>41</PEAKLISTENERS>
<MAXLISTENERS>200</MAXLISTENERS>
<REPORTEDLISTENERS>0</REPORTEDLISTENERS>
<AVERAGETIME>139</AVERAGETIME>
<SERVERGENRE>AutoDJ</SERVERGENRE>
<SERVERURL></SERVERURL>
<SERVERTITLE></SERVERTITLE>
&#8722;
<SONGTITLE>
Bad Boy Bill feat Alyssa Palmer - 14. Falling Anthem (Herve's We Are A Beautiful Disaster Remix)
</SONGTITLE>
<SONGURL>http://www.audiorealm.com</SONGURL>
<IRC/>
<ICQ/>
<AIM/>
<WEBHITS>860757</WEBHITS>
<STREAMHITS>18039</STREAMHITS>
<STREAMSTATUS>1</STREAMSTATUS>
<BITRATE>128</BITRATE>
<CONTENT>audio/mpeg</CONTENT>
<VERSION>1.9.8</VERSION>
&#8722;
<SONGHISTORY>
&#8722;
<SONG>
<PLAYEDAT>1274810220</PLAYEDAT>
&#8722;
<TITLE>
Bad Boy Bill feat Alyssa Palmer - 14. Falling Anthem (Herve's We Are A Beautiful Disaster Remix)
</TITLE>
</SONG>
&#8722;
<SONG>
<PLAYEDAT>1274809970</PLAYEDAT>
&#8722;
<TITLE>
Unknown - Pure Garage Presents 100 Garage Classics CD2 6 Never Gonna Let You Go Tina Moore
</TITLE>
</SONG>
&#8722;
<SONG>
<PLAYEDAT>1274809875</PLAYEDAT>
<TITLE>Lil Wayne (Nasty Ways Remix) - Lollipop</TITLE>
</SONG>
&#8722;
<SONG>
<PLAYEDAT>1274809648</PLAYEDAT>
&#8722;
<TITLE>
DJ Khaled All I Do Is Win feat Ludacris Rick Ross Snoop Dogg T - DJ Khaled 'All I Do Is Win' feat. Ludacris. Rick Ross. Snoop Dogg & T-Pain
</TITLE>
</SONG>
&#8722;
<SONG>
<PLAYEDAT>1274809439</PLAYEDAT>
&#8722;
<TITLE>
Unknown - Pure Garage Presents 100 Garage Classics CD1 5 Whats it gonna be H TWO 0 Feat Platinum
</TITLE>
</SONG>
&#8722;
<SONG>
<PLAYEDAT>1274809252</PLAYEDAT>
<TITLE>Replay - Replay - IYAZ +lyrics!</TITLE>
</SONG>
&#8722;
<SONG>
<PLAYEDAT>1274809221</PLAYEDAT>
<TITLE>Unknown - Generic Bed May2</TITLE>
</SONG>
&#8722;
<SONG>
<PLAYEDAT>1274809002</PLAYEDAT>
<TITLE>? - E</TITLE>
</SONG>
&#8722;
<SONG>
<PLAYEDAT>1274808806</PLAYEDAT>
<TITLE>TC - 08. Where's My Money (Jack Beats Remix)</TITLE>
</SONG>
&#8722;
<SONG>
<PLAYEDAT>1274808594</PLAYEDAT>
<TITLE>Hadouken - Hadouken - Mic Check</TITLE>
</SONG>
</SONGHISTORY>
</SHOUTCASTSERVER>

RE: Now playing - XML Document by carllawl on 05-25-2010 at 08:09 PM

So far I have

code:
var url = "http://69.175.111.66:8301/admin.cgi?mode=viewxml";

Interop.Call("wininet.dll", "DeleteUrlCacheEntryW", url);
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", url, true, "user", "pass");
xmlhttp.onreadystatechange = function () {
   if (xmlhttp.readyState == 4)
      if (xmlhttp.responseCode == 200) {
         // Data from URL was retrieved successfully
         // Data is saved in the variable xmlhttp.responseText
      } else {
         // The server returned an HTTP code other than 200
   }
}
xmlhttp.send();

function OnEvent_ChatWndReceiveMessage(ChatWnd,Origin, Message, MessageKind) {




// If message is start
    if(Message.toLowerCase() == "!current")
    {       
    ChatWnd.SendMessage("Currently playing is:");
    ChatWnd.SendMessage(xmlhttp.responseText);
    }


}

RE: Now playing - XML Document by matty on 05-26-2010 at 12:59 PM

js code:
var url = 'http://69.175.111.66:8301/admin.cgi?mode=viewxml';

function GetXmlFromUrl () {
    Interop.Call('wininet.dll', 'DeleteUrlCacheEntryW', url);
    var xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
    xmlhttp.open('GET', url, true, 'user', 'pass');
    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4) {
            if (xmlhttp.responseCode == 200) {
                return xmlhttp.responseText;
            }
        }
    }
    xmlhttp.send();
}

function CreateXML() {
    try {
        var xml = new ActiveXObject("Microsoft.XMLDOM");
    } catch(e) { try {
        var xml = new ActiveXObject("MSXML2.DOMDocument");
    } catch(e) { return; } }
    xml.async = false;
    return xml;
}

function OnEvent_ChatWndReceiveMessage(pChatWnd, sOrigin, sMessage, nType) {
    if(sMessage.toLowerCase() == '!current') {       
        var sXml = GetXmlFromUrl();
        var oXml = CreateXML();
        if (oXml !== false) {
            oXml.LoadXml(sXml);
            pChatWnd.SendMessage('Current playing '+oXml.selectSingleNode('//SHOUTCASTSERVER/SONGTITLE').text());
        }
    }
}

RE: Now playing - XML Document by carllawl on 05-26-2010 at 01:16 PM

it doesnt seem to be working :(

code:
Error: Object doesn't support this property or method (code: -2146827850)
       File: Shoutcast.js. Line: 32.
Function OnEvent_ChatWndReceiveMessage returned an error. Code: -2147352567


RE: Now playing - XML Document by matty on 05-26-2010 at 01:22 PM

Change this line:

js code:
oXml.LoadXml(sXml);
to:
js code:
oXml.loadXML(sXml);

I thought the function was LoadXml... guess I was wrong.
RE: Now playing - XML Document by carllawl on 05-26-2010 at 01:46 PM

code:
Function called: OnEvent_ChatWndReceiveMessage
Error: 'selectSingleNode(...!)' is null or not an object (code: -2146823281)
       File: Shoutcast.js. Line: 33.
Function OnEvent_ChatWndReceiveMessage returned an error. Code: -2147352567


Any ideas?

the admin and pass are correct for sure
RE: Now playing - XML Document by matty on 05-26-2010 at 02:07 PM

Ok well I screwed up again... remove the () from this line:

js code:
pChatWnd.SendMessage('Current playing '+oXml.selectSingleNode('//SHOUTCASTSERVER/SONGTITLE').text());

Should then be:
js code:
pChatWnd.SendMessage('Current playing '+oXml.selectSingleNode('//SHOUTCASTSERVER/SONGTITLE').text);

RE: Now playing - XML Document by carllawl on 05-26-2010 at 02:11 PM

code:
Function called: OnEvent_ChatWndReceiveMessage
Error: Object required (code: -2146827864)
       File: Shoutcast.js. Line: 33.
Function OnEvent_ChatWndReceiveMessage returned an error. Code: -2147352567


still not working

i also appreciate the help youve given me so far
RE: Now playing - XML Document by matty on 05-27-2010 at 01:01 PM

I couldn't get on the forums at all last night. I will try again tonight but someone else may have to take a look...


RE: Now playing - XML Document by carllawl on 05-27-2010 at 05:26 PM

the user is admin and pass is t3st2 if it is any help


RE: Now playing - XML Document by carllawl on 05-31-2010 at 11:33 PM

still no one able to help me with this?


RE: Now playing - XML Document by matty on 06-01-2010 at 01:06 PM

I had it working then it stopped and I haven't been home to play with it again.


RE: Now playing - XML Document by carllawl on 06-04-2010 at 05:12 PM

how did you get it working?


RE: Now playing - XML Document by carllawl on 06-12-2010 at 12:49 AM

no one able to help me with this?