Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
CWinthrop
Visitor

Shoutcast Metadata Parsing?

Hi all, brand-spanking new channel creator here, so go easy on me. 🙂

I'm developing a private channel for the station I work for, and I need to customize the metadata coming from our Shoutcast stream.

I've started out using the audioapp example, and have a very basic channel working, but on the live stream page (based on the Npr.brs example) I need a way to break down the metadata in a certain way.

Instead of "Current Song" by "Current Artist" our stream server sends out "Current Show with DJ Name ~ Current Artist - Current Song".

How can I get that information (I'm assuming using the "http://server:port/7.html" data?) break it down into the parts I need, and display it? Having it update every 60-90 seconds would be a bonus.

Thanks in advance for helping out a senile old man!
0 Kudos
5 REPLIES 5
RokuChris
Roku Employee
Roku Employee

Re: Shoutcast Metadata Parsing?

"CWinthrop" wrote:
Instead of "Current Song" by "Current Artist" our stream server sends out "Current Show with DJ Name ~ Current Artist - Current Song".

How can I get that information (I'm assuming using the "http://server:port/7.html" data?) break it down into the parts I need, and display it? Having it update every 60-90 seconds would be a bonus.


That's one approach, though XML or JSON will be easier to parse than HTML.

On newer boxes you might also be able to get that data from the stream itself with the isTimedMetaData() event

http://sdkdocs.roku.com/display/sdkdoc/ ... amicasVoid
http://sdkdocs.roku.com/display/sdkdoc/ ... layerEvent
0 Kudos
CWinthrop
Visitor

Re: Shoutcast Metadata Parsing?

"RokuChris" wrote:
That's one approach, though XML or JSON will be easier to parse than HTML.

On newer boxes you might also be able to get that data from the stream itself with the isTimedMetaData() event

http://sdkdocs.roku.com/display/sdkdoc/ ... amicasVoid
http://sdkdocs.roku.com/display/sdkdoc/ ... layerEvent



Ok, now I'm even more lost. 🙂 I found the XML on the streaming server. Can you give me an example of how to add it to the player code I have now, and break the string down into the fields I need?

And speaking of XML, the way the channel is set up now, we have a Show Archive section that has a selection of shows from the previous week. If I have to add or remove a show, can that be done through an XML file on my server rather than editing the BRS file and repackaging the channel every time? And if so, how?

I'm VERY new at this, if you haven't noticed. 🙂
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: Shoutcast Metadata Parsing?

"CWinthrop" wrote:
I found the XML on the streaming server. Can you give me an example of how to add it to the player code I have now, and break the string down into the fields I need?


Without knowing what the XML looks like, you'd do something like this. There are several examples of parsing XML in the SDK.

xfer = CreateObject("roURLTransfer")
xfer.SetURL(xmlURL)
str = xfer.GetToString()
xml = CreateObject("roXMLElement")
if xml.Parse()
' parse the necessary data out of the XML
end if


"CWinthrop" wrote:
And speaking of XML, the way the channel is set up now, we have a Show Archive section that has a selection of shows from the previous week. If I have to add or remove a show, can that be done through an XML file on my server rather than editing the BRS file and repackaging the channel every time? And if so, how?


Yes, you do not want to have to update the channel every time you change the content. In general you want to do everything you can to minimize channel updates. Check out the MRSS and/or videoplayer examples to see how that data can be pulled from a cloud service.
0 Kudos
CWinthrop
Visitor

Re: Shoutcast Metadata Parsing?

"RokuChris" wrote:
Without knowing what the XML looks like, you'd do something like this. There are several examples of parsing XML in the SDK.


Ok, the specific line of XML from the server is this:

<SONGTITLE>Ride the Storm with DJ Storm ~ AC/DC - Stormy May Day</SONGTITLE>


I'd want to split that into Show name (Ride the Storm), DJ name (DJ Storm), and Track (AC/DC - Stormy May Day).

In PHP or Bash, I could do it in 30 seconds. But in Brightscript I'm not even sure how to echo a variable to the screen.

Once I get this working, then I'll move on to using XML for the archived show recordings. And then on to the other features the station staff are begging for. 🙂
0 Kudos
EnTerr
Roku Guru

Re: Shoutcast Metadata Parsing?

"CWinthrop" wrote:
Ok, the specific line of XML from the server is this:
<SONGTITLE>Ride the Storm with DJ Storm ~ AC/DC - Stormy May Day</SONGTITLE>

I'd want to split that into Show name (Ride the Storm), DJ name (DJ Storm), and Track (AC/DC - Stormy May Day).

linkback note: this is answered further in viewtopic.php?f=34&t=66909&p=428066#p428064
0 Kudos