Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
kelvis2000
Level 7

Using Eclipse to create channel, error message

I have a instructional channel with about 30 videos whose size
ranges from 100 to 200 megabytes.
I am using Eclipse to create this channel, the below message appeared in the console.
I had my videos working and now they are very slow for some reason?
They are hosted on Amazon Cloud.
I did change the "Required Features" in the channel properties from Roku 3
to none, would this have a effect and also should a m4v movie work?
I am guessing my instructional video Channel should be Roku 3?
Presently I am going from the computer to the Roku box connected to the TV
so maybe the "Required Features" has no bearing here?


Note: GC - Found 30 orphaned objects (objects in a circular ref loop).
------ Running ------
created feed connection for http://ds1g3wm5vt4h6.cloudfront.net/XML/categories.xml
url: http://ds1g3wm5vt4h6.cloudfront.net/XML/categories.xml
Took: 168ms
Parse Took: 0ms
begin category node parsing
number of categories: 4
ParseCategoryNode: category
category: Delta Blues | All About Delta Blues.
BRIGHTSCRIPT: ERROR: Runtime: FOR EACH value is Invalid: pkg:/source/categoryFeed.brs(176)
added new child node
ParseCategoryNode: category
category: Texas Blues | All about Texas Blues.
BRIGHTSCRIPT: ERROR: Runtime: FOR EACH value is Invalid: pkg:/source/categoryFeed.brs(176)
added new child node
ParseCategoryNode: category
category: Contemporary Blues | All about Current Blues.
BRIGHTSCRIPT: ERROR: Runtime: FOR EACH value is Invalid: pkg:/source/categoryFeed.brs(176)
added new child node
ParseCategoryNode: category
category: Ragtime Blues | All about Ragtime Blues.
BRIGHTSCRIPT: ERROR: Runtime: FOR EACH value is Invalid: pkg:/source/categoryFeed.brs(176)
added new child node
Traversing: 3ms


Thanks

Kevin
0 Kudos
7 Replies
NewManLiving
Level 7

Re: Using Eclipse to create channel, error message

I would be looking at the code. the error messages related to the brightscript code indicate that something is wrong. Invalid for each loops and circular referencing indicates a problem.. You need to post the code
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
Highlighted
kelvis2000
Level 7

Re: Using Eclipse to create channel, error message

Thank You for your help NewManLiving,
Here is code from CategoryFeed.brs

'******************************************************
'** RokuChannelMaker Template
'** 2014
'** Copyright (c) 2014 RokuChannelMaker.com All Rights Reserved.
'******************************************************

'******************************************************
' Set up the category feed connection object
' This feed provides details about top level categories
'******************************************************
Function InitCategoryFeedConnection() As Object

conn = CreateObject("roAssociativeArray")

conn.UrlPrefix = "http://ds1g3wm5vt4h6.cloudfront.net/XML"
conn.UrlCategoryFeed = conn.UrlPrefix + "/categories.xml"

conn.Timer = CreateObject("roTimespan")

conn.LoadCategoryFeed = load_category_feed
conn.GetCategoryNames = get_category_names

print "created feed connection for " + conn.UrlCategoryFeed
return conn

End Function

'*********************************************************
'** Create an array of names representing the children
'** for the current list of categories. This is useful
'** for filling in the filter banner with the names of
'** all the categories at the next level in the hierarchy
'*********************************************************
Function get_category_names(categories As Object) As Dynamic

categoryNames = CreateObject("roArray", 100, true)

for each category in categories.kids
'print category.Title
categoryNames.Push(category.Title)
next

return categoryNames

End Function


'******************************************************************
'** Given a connection object for a category feed, fetch,
'** parse and build the tree for the feed. the results are
'** stored hierarchically with parent/child relationships
'** with a single default node named Root at the root of the tree
'******************************************************************
Function load_category_feed(conn As Object) As Dynamic

http = NewHttp(conn.UrlCategoryFeed)

Dbg("url: ", http.Http.GetUrl())

m.Timer.Mark()
rsp = http.GetToStringWithRetry()
Dbg("Took: ", m.Timer)

m.Timer.Mark()
xml=CreateObject("roXMLElement")
if not xml.Parse(rsp) then
print "Can't parse feed"
return invalid
endif
Dbg("Parse Took: ", m.Timer)

m.Timer.Mark()
if xml.category = invalid then
print "no categories tag"
return invalid
endif

if islist(xml.category) = false then
print "invalid feed body"
return invalid
endif

if xml.category[0].GetName() <> "category" then
print "no initial category tag"
return invalid
endif

topNode = MakeEmptyCatNode()
topNode.Title = "root"
topNode.isapphome = true

print "begin category node parsing"

categories = xml.GetChildElements()
print "number of categories: " + itostr(categories.Count())
for each e in categories
o = ParseCategoryNode(e)
if o <> invalid then
topNode.AddKid(o)
print "added new child node"
else
print "parse returned no child node"
endif
next
Dbg("Traversing: ", m.Timer)

return topNode

End Function

'******************************************************
'MakeEmptyCatNode - use to create top node in the tree
'******************************************************
Function MakeEmptyCatNode() As Object
return init_category_item()
End Function


'***********************************************************
'Given the xml element to an <Category> tag in the category
'feed, walk it and return the top level node to its tree
'***********************************************************
Function ParseCategoryNode(xml As Object) As dynamic
o = init_category_item()

print "ParseCategoryNode: " + xml.GetName()
'PrintXML(xml, 5)

'parse the curent node to determine the type. everything except
'special categories are considered normal, others have unique types
if xml.GetName() = "category" then
print "category: " + xml@title + " | " + xml@description
o.Type = "normal"
o.Title = xml@title
o.Description = xml@Description
o.ShortDescriptionLine1 = xml@Title
o.ShortDescriptionLine2 = xml@Description
o.SDPosterURL = xml@sd_img
o.HDPosterURL = xml@hd_img
o.Feed = xml@feed
else if xml.GetName() = "categoryLeaf" then
o.Type = "normal"
else if xml.GetName() = "specialCategory" then
if invalid <> xml.GetAttributes() then
for each a in xml.GetAttributes()
if a = "type" then
o.Type = xml.GetAttributes()[a]
print "specialCategory: " + xml@type + "|" + xml@title + " | " + xml@description
o.Title = xml@title
o.Description = xml@Description
o.ShortDescriptionLine1 = xml@Title
o.ShortDescriptionLine2 = xml@Description
o.SDPosterURL = xml@sd_img
o.HDPosterURL = xml@hd_img
o.Feed = xml@feed
endif
next
endif
else
print "ParseCategoryNode skip: " + xml.GetName()
return invalid
endif

'only continue processing if we are dealing with a known type
'if new types are supported, make sure to add them to the list
'and parse them correctly further downstream in the parser
while true
if o.Type = "normal" exit while
if o.Type = "special_category" exit while
print "ParseCategoryNode unrecognized feed type"
return invalid
end while

'get the list of child nodes and recursed
'through everything under the current node
for each e in xml.GetBody()
name = e.GetName()
if name = "category" then
print "category: " + e@title + " [" + e@description + "]"
kid = ParseCategoryNode(e)
kid.Title = e@title
kid.Description = e@Description
kid.ShortDescriptionLine1 = xml@Description
kid.SDPosterURL = xml@sd_img
kid.HDPosterURL = xml@hd_img
kid.Feed = e@feed
o.AddKid(kid)
else if name = "categoryLeaf" then
print "categoryLeaf: " + e@title + " [" + e@description + "]"
kid = ParseCategoryNode(e)
kid.Title = e@title
kid.Description = e@Description
kid.Feed = e@feed
o.AddKid(kid)
else if name = "specialCategory" then
print "specialCategory: " + e@title + " [" + e@description + "]"
kid = ParseCategoryNode(e)
kid.Title = e@title
kid.Description = e@Description
kid.sd_img = e@sd_img
kid.hd_img = e@hd_img
kid.Feed = e@feed
o.AddKid(kid)
endif
next

return o
End Function


'******************************************************
'Initialize a Category Item
'******************************************************
Function init_category_item() As Object
o = CreateObject("roAssociativeArray")
o.Title = ""
o.Type = "normal"
o.Description = ""
o.Kids = CreateObject("roArray", 100, true)
o.Parent = invalid
o.Feed = ""
o.IsLeaf = cn_is_leaf
o.AddKid = cn_add_kid
return o
End Function


'********************************************************
'** Helper function for each node, returns true/false
'** indicating that this node is a leaf node in the tree
'********************************************************
Function cn_is_leaf() As Boolean
if m.Kids.Count() > 0 return true
if m.Feed <> "" return false
return true
End Function


'*********************************************************
'** Helper function for each node in the tree to add a
'** new node as a child to this node.
'*********************************************************
Sub cn_add_kid(kid As Object)
if kid = invalid then
print "skipping: attempt to add invalid kid failed"
return
endif

kid.Parent = m
m.Kids.Push(kid)
End Sub


Thanks

Kevin
0 Kudos
kelvis2000
Level 7

Re: Using Eclipse to create channel, error message

Here is starting at line 174 CategoryFeed.brs
 'get the list of child nodes and recursed
'through everything under the current node
for each e in xml.GetBody()
name = e.GetName()
if name = "category" then
print "category: " + e@title + " [" + e@description + "]"
kid = ParseCategoryNode(e)
kid.Title = e@title
kid.Description = e@Description
kid.ShortDescriptionLine1 = xml@Description
kid.SDPosterURL = xml@sd_img
kid.HDPosterURL = xml@hd_img
kid.Feed = e@feed
o.AddKid(kid)
else if name = "categoryLeaf" then
print "categoryLeaf: " + e@title + " [" + e@description + "]"
kid = ParseCategoryNode(e)
kid.Title = e@title
kid.Description = e@Description
kid.Feed = e@feed
o.AddKid(kid)
else if name = "specialCategory" then
print "specialCategory: " + e@title + " [" + e@description + "]"
kid = ParseCategoryNode(e)
kid.Title = e@title
kid.Description = e@Description
kid.sd_img = e@sd_img
kid.hd_img = e@hd_img
kid.Feed = e@feed
o.AddKid(kid)
endif
next

return o
End Function


'******************************************************
'Initialize a Category Item
'******************************************************
Function init_category_item() As Object
o = CreateObject("roAssociativeArray")
o.Title = ""
o.Type = "normal"
o.Description = ""
o.Kids = CreateObject("roArray", 100, true)
o.Parent = invalid
o.Feed = ""
o.IsLeaf = cn_is_leaf
o.AddKid = cn_add_kid
return o
End Function


'********************************************************
'** Helper function for each node, returns true/false
'** indicating that this node is a leaf node in the tree
'********************************************************
Function cn_is_leaf() As Boolean
if m.Kids.Count() > 0 return true
if m.Feed <> "" return false
return true
End Function


'*********************************************************
'** Helper function for each node in the tree to add a
'** new node as a child to this node.
'*********************************************************
Sub cn_add_kid(kid As Object)
if kid = invalid then
print "skipping: attempt to add invalid kid failed"
return
endif

kid.Parent = m
m.Kids.Push(kid)
End Sub
0 Kudos
NewManLiving
Level 7

Re: Using Eclipse to create channel, error message

In work right now. But off the bat I would see what getbody is returning since that is an invalid for loop. Look at it in detail when I get out of here.
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
NewManLiving
Level 7

Re: Using Eclipse to create channel, error message

After looking at the code, The circular reference is due to the linked-list nature of the parser. Although the parser should check if GetBody returns invalid, it does no harm in the case where there are no sub-children, but falls through. So you do get your four category sub-items in the kids member of the topnode. I don't know about the 30 videos but this xml has only four items. As to why it is slower I really don't know, if nothing in the code has changed.
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
kelvis2000
Level 7

Re: Using Eclipse to create channel, error message

ThankYou NewManLiving;
I am starting to wonder if its my Roku box which seems to get pretty hot,
the first video always downloads fine regardless of which one I choose with the following videos
very slow.
Kevin
0 Kudos
kelvis2000
Level 7

Re: Using Eclipse to create channel, error message

The channel is almost done being tested, they found a few errors which I fixed now its ready to
go back for final approval. Should I submit and if they see a problem they will let me know?
Thanks
Kevin
0 Kudos