perdon que publique aca no me deja publicar el la seccion python
buenas tardes les comento que soy muy novato en python estoy armando un canal
roku pero al agregar una categoria siempre me usa el mismo rss
http://xxx.xxx.xxx.xxx/testserie/house.rss
nesesito que al elegir twd use el rss
http://xxx.xxx.xxx.xxx/testserie/twdead.rss
muchas gracias y disculpen si no se entendio
sub RunUserInterface()
screen = CreateObject("roSGScreen")
scene = screen.CreateScene("HomeScene")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)
screen.Show()
LabelList = [
{title : "The Walking Dead"
urlrss : twd
}
{title : "Dr House"
urlrss : house
}
]
OptionsList = [{Title:"Reproducir"},
{Title:"Reproducir Todo"}]
scene.Content = ContentList2Node(GetApiArray())
scene.LabelContent = ContentList2Node(LabelList)
scene.OptionsContent = ContentList2Node(OptionsList)
while true
msg = wait(0, port)
print "------------------"
print "msg = "; msg
end while
if screen <> invalid then
screen.Close()
screen = invalid
end if
end sub
Function ParseXMLContent(list As Object)
RowItems = createObject("RoSGNode","ContentNode")
for each rowAA in list
row = ContentList2Node(rowAA.ContentList)
row.Title = rowAA.Title
RowItems.appendChild(row)
end for
return RowItems
End Function
function ContentList2Node(contentList as Object) as Object
result = createObject("roSGNode","ContentNode")
for each itemAA in contentList
item = createObject("roSGNode", "ContentNode")
item.SetFields(itemAA)
result.appendChild(item)
end for
return result
end function
Function GetApiArray()
url = CreateObject("roUrlTransfer")
url.SetUrl("http://xxx.xxx.xxx.xxx/testserie/" + (urlrss) + ".rss")
rsp = url.GetToString()
responseXML = ParseXML(rsp)
If responseXML <> invalid then
responseXML = responseXML.GetChildElements()
responseArray = responseXML.GetChildElements()
End if
result = []
for each xmlItem in responseArray
if xmlItem.getName() = "item"
itemAA = xmlItem.GetChildElements()
if itemAA <> invalid
item = {}
for each xmlItem in itemAA
item[xmlItem.getName()] = xmlItem.getText()
if xmlItem.getName() = "media:content"
item.stream = {url : xmlItem.url}
item.url = xmlItem.getAttributes().url
item.streamFormat = xmlItem.getAttributes().url
mediaContent = xmlItem.GetChildElements()
for each mediaContentItem in mediaContent
if mediaContentItem.getName() = "media:thumbnail"
item.HDPosterUrl = mediaContentItem.getattributes().url
item.hdBackgroundImageUrl = mediaContentItem.getattributes().url
end if
end for
end if
end for
result.push(item)
end if
end if
end for
return result
End Function
Function ParseXML(str As String) As dynamic
if str = invalid return invalid
xml = CreateObject("roXMLElement")
if not xml.Parse(str) return invalid
return xml
End Function