"EnTerr" wrote:
ContentNode is designed as a "vessel" for a Roku multimedia item (one video, one audio etc). It is just a Node with extra data junk (i.e. fields) shoved into it. Use ContentNode only when
- a RSG component demands one or
- your data is well-described by https://sdkdocs.roku.com/display/sdkdoc/Content+Meta-Data
If you have a collection of e.g. videos, you should use a Node as container - or roAA, depending on threading concerns.
Be more specific - what is your case?
sub setEpg()
print "setting up content"
m.channel = m.liveTvJsonReaderTask.getField("content")
i = 0
while i < m.channel.getChildCount()
print "m.channel.getChild(i)", m.channel.getChild(i)
print "m.channel.getChild(i).TITLE:", m.channel.getChild(i).TITLE
i = i + 1
end while
end sub
channels = m.liveTvJsonReaderTask.content.getChildren(1e4, 0)
for each channel in channels:
print channel.title, channel
next
channelNoid = m.liveTvJsonReaderTask.content
for i = 0 to channelNoid.getChildCount()-1:
channel = channelNoid.getChild(i)
print channel.title, channel
next
"EnTerr" wrote:
Oh, that. Then you can as well dochannels = m.liveTvJsonReaderTask.content.getChildren(1e4, 0)
for each channel in channels:
print channel.title, channel
next
or more convolutedlychannelNoid = m.liveTvJsonReaderTask.content
for i = 0 to channelNoid.getChildCount()-1:
channel = channelNoid.getChild(i)
print channel.title, channel
next
Word has it that in coming version of RSG you could just use a roArray-type field instead of doing this whole gallimaufry (using Node as array-alike container).
"adrianc1982" wrote:
It would be great to have an interfase that returns roassociativearray with more roassociativearrays inside.
' you cant have this: '
myNode.addFields({ myField: [1, 2, 3] })
' however, you can cheat and do this just fine: '
myNode.addFields({ myField: {bless_RSGs_maker: [1, 2, 3]} })
Or just a dynamic format hahah
But yeah im using the content node as an array since thats what i found i could use..
"EnTerr" wrote:"adrianc1982" wrote:
It would be great to have an interfase that returns roassociativearray with more roassociativearrays inside.
You already have that, you can do roAssociativeArray of... anything, really. What you don't have is <roArray of anything>. Because... RSG creator's vision ("think different, not necessarily better"):' you cant have this: '
myNode.addFields({ myField: [1, 2, 3] })
' however, you can cheat and do this just fine: '
myNode.addFields({ myField: {bless_RSGs_maker: [1, 2, 3]} })Or just a dynamic format hahah
But yeah im using the content node as an array since thats what i found i could use..
Here is me struggling with the same earlier https://forums.roku.com/viewtopic.php?f=34&t=96382
"adrianc1982" wrote:
Just read this answer before posting in your thread, im new to RSG so i havent had the chance to or flight hours to discover this. I really have always thought of roku development as hacky because of all the cheating you have to do. Thank you so much for the heads up even though this is not what we should be doing!
"EnTerr" wrote:"adrianc1982" wrote:
Just read this answer before posting in your thread, im new to RSG so i havent had the chance to or flight hours to discover this. I really have always thought of roku development as hacky because of all the cheating you have to do. Thank you so much for the heads up even though this is not what we should be doing!
Correct, coding for Roku is very hacky. Some of the hacks are really beautiful and useful, others - not so much. The RSG in particular will make you wonder "man, they must sell some really strong ganja in those California pot dispensaries!"
"EnTerr" wrote:"adrianc1982" wrote:
It would be great to have an interfase that returns roassociativearray with more roassociativearrays inside.
You already have that, you can do roAssociativeArray of... anything, really. What you don't have is <roArray of anything>. Because... RSG creator's vision ("think different, not necessarily better"):' you cant have this: '
myNode.addFields({ myField: [1, 2, 3] })
' however, you can cheat and do this just fine: '
myNode.addFields({ myField: {bless_RSGs_maker: [1, 2, 3]} })Or just a dynamic format hahah
But yeah im using the content node as an array since thats what i found i could use..
Here is me struggling with the same earlier https://forums.roku.com/viewtopic.php?f=34&t=96382
Content = CreateObject("roSGNode", "ContentNode")
for each item in result
?item
data=Content.createChild("ContentNode")
data.addfields({"resultfield": {info: [item]}})
end for
?data
m.top.content=Content
data=m.ContentTaskp.getChildren(1e4, 0)
for each item in data
?item
end for