What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [REQ] BBC Radio 1 Now Playing Script. Simple Rss Feed

[REQ] BBC Radio 1 Now Playing Script. Simple Rss Feed
Author: Message:
webbo04
Junior Member
**

BEASTA!!

Posts: 15
32 / Male / –
Joined: Apr 2007
O.P. [REQ] BBC Radio 1 Now Playing Script. Simple Rss Feed
Hey All,

I found this which is basically a rss feed of what BBC Radio 1 Is Now Playing! All I want is this on my PM. Before you ask/say I've already tried the RSSreader but it takes AGES to phase and eventually i have to cancel. Anybody help?

All I'd want it to do is say

Radio 1 Is Now Playing: [LATEST RSS ITEM HERE]

Thanks!

EDIT: Updated To A Better RSS Feed

This post was edited on 02-11-2008 at 04:37 PM by webbo04.
02-11-2008 04:17 PM
Profile E-Mail PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: [REQ] BBC Radio 1 Now Playing Script. Simple Rss Feed
The last update is 20 minutes behind :s Might have abash after jobs though
<Eljay> "Problems encountered: shit blew up" :zippy:
02-11-2008 04:29 PM
Profile PM Find Quote Report
webbo04
Junior Member
**

BEASTA!!

Posts: 15
32 / Male / –
Joined: Apr 2007
O.P. RE: [REQ] BBC Radio 1 Now Playing Script. Simple Rss Feed
Yeah, I'll try and find a better feed!

EDIT: Here's A Better One

This post was edited on 02-11-2008 at 04:37 PM by webbo04.
02-11-2008 04:35 PM
Profile E-Mail PM Web Find Quote Report
MeEtc
Patchou's look-alike
*****

Avatar
In the Shadow Gallery once again

Posts: 2200
Reputation: 60
38 / Male / Flag
Joined: Nov 2004
Status: Away
RE: [REQ] BBC Radio 1 Now Playing Script. Simple Rss Feed
They're the same feed, as far as I can see
[Image: signature/]     [Image: sharing.png]
I cannot hear you. There is a banana in my ear.
02-11-2008 05:06 PM
Profile PM Web Find Quote Report
Stigmata
Veteran Member
*****



Posts: 3520
Reputation: 45
21 / Other / Flag
Joined: Jul 2003
RE: [REQ] BBC Radio 1 Now Playing Script. Simple Rss Feed
the rss feed seems to be an hour behind...

I dont think it would be worth it honestly :/
02-11-2008 06:07 PM
Profile PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: [REQ] BBC Radio 1 Now Playing Script. Simple Rss Feed
http://www.bbc.co.uk/radio1/wm_asx/aod/radio1.asx

Use that link to play it in WMP and see if the artist/song show up in your PSM through the built in WLM function :p
<Eljay> "Problems encountered: shit blew up" :zippy:
02-11-2008 06:32 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [REQ] BBC Radio 1 Now Playing Script. Simple Rss Feed
code:
/*
*
*    BBC song from RSS
*    matty
*
*/

var sPsm;

function OnEvent_Initialize() {
    if (Messenger.MyStatus < STATUS_INVISIBLE) return false;
    MsgPlus.AddTimer('grabSong', 60000); // one minute
}


function createXml(url) {
    Interop.Call('wininet.dll', 'DeleteUrlCacheEntryW', url);
    xml = new ActiveXObject('Microsoft.XMLDOM');
    xml.async = true;
   
    xml.load(url);
    return xml;
}

function OnEvent_Timer() {
    var xml = createXml('http://bbc-hackday.dyndns.org/tracks/radio1.rss');
   
    xml.onreadystatechange=function() {
        if (xml.readyState === 4)
            var newPsm = xml.selectSingleNode('//rss/channel/item/dc:creator').text+' - '+xml.selectSingleNode('//rss/channel/item/dc:title').text;
            Debug.Trace(newPsm);
            if (sPsm !== newPsm) {
                Messenger.MyPersonalMessage = newPsm;
                sPsm = newPsm;
            }
        xml = null;
    }
    MsgPlus.AddTimer('grabSong', 60000); // one minute
}
02-11-2008 06:38 PM
Profile E-Mail PM Find Quote Report
webbo04
Junior Member
**

BEASTA!!

Posts: 15
32 / Male / –
Joined: Apr 2007
O.P. RE: [REQ] BBC Radio 1 Now Playing Script. Simple Rss Feed
Oh Great!

How Do I Put Radio 1 Playing: infront of it?
02-11-2008 07:06 PM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [REQ] BBC Radio 1 Now Playing Script. Simple Rss Feed
quote:
Originally posted by matty
var newPsm = 'Radio 1 Playing: '+xml.selectSingleNode('//rss/channel/item/dc:creator').text+' - '+xml.selectSingleNode('//rss/channel/item/dc:title').text;
02-11-2008 07:40 PM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: [REQ] BBC Radio 1 Now Playing Script. Simple Rss Feed
Matty, you should be aware that you have to declare your onreadystatechange event BEFORE you call xml.load(). So, either you simply place the contents of the createXml function in the timer event, or you add the callback function as a parameter to the createXml function and assign it to onreadystatechange in the createXml function.

I already explained this in Mattike's reply to XMLHTTP Not Loading After Save. The thing is that if you declare it after the load() function, there's a (small) chance that the asynchronous XML loading is faster than the process of the script.

code:
...

function createXml(url, funcReadyStateChange) {
    Interop.Call('wininet.dll', 'DeleteUrlCacheEntryW', url);
    xml = new ActiveXObject('Microsoft.XMLDOM');
    xml.async = true;
    xml.onreadystatechange = funcReadyStateChange;
   
    xml.load(url);
    return xml;
}

function OnEvent_Timer() {
    var xml = createXml('http://bbc-hackday.dyndns.org/tracks/radio1.rss', function() {
        if (xml.readyState === 4)
            var newPsm = xml.selectSingleNode('//rss/channel/item/dc:creator').text+' - '+xml.selectSingleNode('//rss/channel/item/dc:title').text;
            Debug.Trace(newPsm);
            if (sPsm !== newPsm) {
                Messenger.MyPersonalMessage = newPsm;
                sPsm = newPsm;
            }
        xml = null;
    });

    MsgPlus.AddTimer('grabSong', 60000); // one minute
}
Also, I don't really know for the XMLDOM but I think you should also check the xml.status to see if it equals 200 (xml.status === 200) in the event. I don't really know if it functions like the XMLHTTP, but the xml.readyState documentation says:
quote:
Originally posted by DevGuru XML DOM :: readyState
  • ...
  • COMPLETED(4)
    the document has been completely loaded, successfully or unsuccessfully.

Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
02-11-2008 08:32 PM
Profile E-Mail PM Web Find Quote Report
« 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