What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Now playing - XML Document

Pages: (2): « First [ 1 ] 2 » Last »
Now playing - XML Document
Author: Message:
carllawl
New Member
*


Posts: 11
Joined: May 2010
O.P. Now playing - XML Document
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>
05-25-2010 06:00 PM
Profile E-Mail PM Find Quote Report
carllawl
New Member
*


Posts: 11
Joined: May 2010
O.P. RE: Now playing - XML Document
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);
    }


}
05-25-2010 08:09 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Now playing - XML Document
Javascript 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());
        }
    }
}

05-26-2010 12:59 PM
Profile E-Mail PM Find Quote Report
carllawl
New Member
*


Posts: 11
Joined: May 2010
O.P. RE: Now playing - XML Document
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

05-26-2010 01:16 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Now playing - XML Document
Change this line:
Javascript code:
oXml.LoadXml(sXml);

to:
Javascript code:
oXml.loadXML(sXml);


I thought the function was LoadXml... guess I was wrong.

This post was edited on 05-26-2010 at 01:23 PM by matty.
05-26-2010 01:22 PM
Profile E-Mail PM Find Quote Report
carllawl
New Member
*


Posts: 11
Joined: May 2010
O.P. RE: Now playing - XML Document
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
05-26-2010 01:46 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Now playing - XML Document
Ok well I screwed up again... remove the () from this line:
Javascript code:
pChatWnd.SendMessage('Current playing '+oXml.selectSingleNode('//SHOUTCASTSERVER/SONGTITLE').text());


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


This post was edited on 05-26-2010 at 02:07 PM by matty.
05-26-2010 02:07 PM
Profile E-Mail PM Find Quote Report
carllawl
New Member
*


Posts: 11
Joined: May 2010
O.P. RE: Now playing - XML Document
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
05-26-2010 02:11 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Now playing - XML Document
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...
05-27-2010 01:01 PM
Profile E-Mail PM Find Quote Report
carllawl
New Member
*


Posts: 11
Joined: May 2010
O.P. RE: Now playing - XML Document
the user is admin and pass is t3st2 if it is any help
05-27-2010 05:26 PM
Profile E-Mail PM Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On