i have a xml with video on demand videos, which DOESNOT support on videoplayer.zip SDK file
im looking for to converter that convert my xml to the supported xml style in roku,
whenever new videos comesup, it automatically have to convert in to the supported xml. is it possible ?
any one have idea ?please share your ideas, and help me out, i appreciate.
If you’re talking about the tag names, it’d be easer to change the code in showfeed.brs to match your xml rather than ‘converting’ existing xml every time it downloads.
The Videoplayer sample SDK has showfeed.brs
'fetch all values from the xml for the current show
item.hdImg = validstr(curShow@hdImg)
item.sdImg = validstr(curShow@sdImg)
item.ContentId = validstr(curShow.contentId.GetText())
item.Title = validstr(curShow.title.GetText())
item.Description = validstr(curShow.description.GetText())
item.ContentType = validstr(curShow.contentType.GetText())
item.ContentQuality = validstr(curShow.contentQuality.GetText())
item.Synopsis = validstr(curShow.synopsis.GetText())
item.Genre = validstr(curShow.genres.GetText())
item.Runtime = validstr(curShow.runtime.GetText())
item.HDBifUrl = validstr(curShow.hdBifUrl.GetText())
item.SDBifUrl = validstr(curShow.sdBifUrl.GetText())
item.StreamFormat = validstr(curShow.streamFormat.GetText())
if item.StreamFormat = "" then 'set default streamFormat to mp4 if doesn't exist in xml
item.StreamFormat = "mp4"
endif
my xml is starting with
in videoplayer its
4
<item
my xml is looks like this,
Do you know any other ways, other than editing show feed.brs file.
Any software that can change my XML tag to the supported XML tag?
Notepad would allow you to open the xml file and do a search/replace – or you could do that with the search/replace function in generalutils.brs before you parse the xml.
Note - string replacement can be extremely slow on roku with a large xml or json file as your source.
from generalutils.brs
'******************************************************
'Replace substrings in a string. Return new string
'******************************************************
Function strReplace(basestr As String,oldsub As String,newsub As String) As String
newstr=""
i=1
While i<=Len(basestr)
x=Instr(i,basestr,oldsub)
If x=0
newstr=newstr+MID(basestr,i)
Exit While
End If
If x>i
newstr=newstr+MID(basestr,i,x-i)
i=x
End If
newstr=newstr+newsub
i=i+Len(oldsub)
End While
Return newstr
End Function
basestr would be rsp, or your downloaded xml prior to parsexml. NewSub would be what you need the tag name to be, oldsub would be what the tag name is now (when you download it)
