this may not be the best sample and sure it can be cleaned up a bit as well as for more error handling
here is what the xml should look like:
<songs>
<song>
<title>song title 1</title>
<url>song url 1</url>
<author>song author 1</title>
<desc>description song 1</desc>
<fmt>format of song (mp3)</fmt>
<image>song image url 1</image>
</song
<song>
<title>song title 2</title>
<url>song url 2</url>
<author>song author 2</title>
<desc>description song 2</desc>
<fmt>format of song (mp3)</fmt>
<image>song image url 2</image>
</song
</songs>
and this is what i used to populate the poster screen, again this is for the audio app and i used the mp3.brs
Function CreateSongList() as Object
aa = CreateObject("roAssociativeArray")
aa.posteritems = CreateObject("roArray", 10, true)
m.UrlBase = "http://XXXX.com/roku"
m.UrlGetMp3Info = m.UrlBase + "/xml/mp3Playlist.php"
http = NewHttp(m.UrlGetMp3Info)
rsp = http.Http.GetToString()
xml = CreateObject("roXMLElement")
if not xml.Parse(rsp) then
print "Can't parse response"
ShowConnectionFailed()
return ""
end if
if xml.GetName() <> "songs"
Dbg("Bad response: ", xml.GetName())
ShowConnectionFailed()
return ""
end if
if islist(xml.GetBody()) = false then
Dbg("No Song information available")
ShowConnectionFailed()
return ""
end if
For Each song in xml.song
'initialize variables with empty strings, just in case they're missing in the XML
title = ""
url = ""
image = ""
fmt = ""
desc = ""
author = ""
title = song.title.GetText()
url = song.url.GetText()
author = song.author.GetText()
image = song.image.GetText()
fmt = song.fmt.GetText()
desc = song.desc.GetText()
song = CreateSong(title, desc, author, fmt, url, image)
aa.posteritems.push(song)
Next
return aa
End Function
Sub DoMp3(from as string)
'Put up poster screen to pick a song to play
SongList = CreateSongList()
Pscreen = StartPosterScreen(SongList, from, "whatever you want here to display on screen")
while true
song = Pscreen.GetSelection(0)
if song = -1 exit while
Show_Audio_Screen(songlist.posteritems[song],"whatever you want here to display on screen")
end while
End Sub
Hope that helps someone else, I got help from Endless and Jbrave on this thread
http://forums.roku.com/viewtopic.php?f=34&t=31901&p=211219#p211219
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway