Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dynamitemedia
Binge Watcher

Re: how to do that Vimeo style "next >>" link?

ok so i am confused why i am getting this error then....



034: Function showPosterSearchScreen(screen As Object) As Integer
035:
036:
037: m.curCategory = 0
038: m.curShow = 0
039:
040: categorySearchList = getCategorySearchList()
041: screen.SetListNames(categorySearchList)
042: screen.SetContentList(getShowsForCategorySearchItem(categorySearchList[0
]))
043:
044:
045: screen.Show()
046:
047: while true
048: msg = wait(0, screen.GetMessagePort())
049: if type(msg) = "roPosterScreenEvent" then
050: if msg.isListFocused() then
051:
052: screen.SetContentList(getShowsForCategorySearchItem(categorySearchList[msg.
GetIndex()]))
053:
054: else if msg.isListItemFocused() then
055:
056: print"list item focused | current show = "; msg.GetIndex()
057:
058: else if msg.isListItemSelected() then
059:
060: m.curShow = displayShowDetailSearchScreen(showSearchList[msg.GetI
ndex()])
061:
062: else if msg.isScreenClosed() then
063: return -1
064: end if
065: end If
066: end while
067:
068:
069: End Function
/tmp/plugin/GLBAAAOr6x58/pkg:/source/searchResults.brs(60): runtime error e7: Array operation attempted on variable not DIM'd.

060: m.curShow = displayShowDetailSearchScreen(showSearchList[msg.GetIndex()])


This # 60 is from the simple poster example... so not sure why i am getting and honestly not even sure which variable its talking about is it m.curShow?


I have been stumped on this for almost 3 days now....
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
TheEndless
Channel Surfer

Re: how to do that Vimeo style "next >>" link?

I imagine it's complaining about about "showSearchList" which isn't defined anywhere else in that function...
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
kbenson
Visitor

Re: how to do that Vimeo style "next >>" link?

showSearchList isn't defined or populated in that function, but you are trying to use it.

This line:

screen.SetContentList(getShowsForCategorySearchItem( categorySearchList[msg.GetIndex()] ))


Is essentially the same as:

screen.SetContentList(getShowsForCategorySearchItem( someRandomNonExetentVariable[msg.GetIndex()] ))


There are no globals. If you want to use something in a function, pass it in.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
dynamitemedia
Binge Watcher

Re: how to do that Vimeo style "next >>" link?

thats strange cause its being returned, do I also need to make it like this?

m.showSearchList

I though that using "Return" made it global

here is the whole code... im trying to do the search while using the video player example...

Sub SearchResultsMain()

'initialize theme attributes like titles, logos and overhang color
initTheme()

'prepare the screen for display and get ready to begin
screen=preShowPosterSearchScreen("", "")
if screen=invalid then
print "unexpected error in preShowPosterSearchScreen"
return
end if

'set to go, time to get started
showPosterSearchScreen(screen)

End Sub

'******************************************************
Function preShowPosterSearchScreen(breadA=invalid, breadB=invalid) As Object

port=CreateObject("roMessagePort")
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(port)
if breadA<>invalid and breadB<>invalid then
screen.SetBreadcrumbText(breadA, breadB)
end if

screen.SetListStyle("arced-landscape")
return screen

End Function

'******************************************************
Function showPosterSearchScreen(screen As Object) As Integer


m.curCategory = 0
m.curShow = 0

categorySearchList = getCategorySearchList()
screen.SetListNames(categorySearchList)
screen.SetContentList(getShowsForCategorySearchItem(categorySearchList[0]))


screen.Show()

while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roPosterScreenEvent" then
if msg.isListFocused() then

screen.SetContentList(getShowsForCategorySearchItem(categorySearchList[msg.GetIndex()]))

else if msg.isListItemFocused() then

print"list item focused | current show = "; msg.GetIndex()

else if msg.isListItemSelected() then

m.curShow = displayShowDetailSearchScreen(showSearchList[msg.GetIndex()])

else if msg.isScreenClosed() then
return -1
end if
end If
end while


End Function

'**********************************************************
'** When a poster on the home screen is selected, we call
'** this function passing an roAssociativeArray with the
'** ContentMetaData for the selected show. This data should
'** be sufficient for the springboard to display
'**********************************************************
Function displayShowDetailSearchScreen(category as Object, showIndex as Integer) As Integer

'add code to create springboard, for now we do nothing
return 1

End Function


'***************************************************************

Function getCategorySearchList() As Object

categorySearchList = CreateObject("roArray", 10, true)

categorySearchList = [ "Search Results" ]
return categorySearchList

End Function

'********************************************************************
Function getShowsForCategorySearchItem(category As Object) as Object


m.UrlBase = "http://iptvmyway.com"
m.UrlGetMp3Info = m.UrlBase + "/searchPlaylist.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 register response: ", xml.GetName())
ShowConnectionFailed()
return ""
end if

if islist(xml.GetBody()) = false then
Dbg("No registration 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.name.GetText()
url = song.url.GetText()
author = song.author.GetText()
image = song.image.GetText()
fmt = song.fmt.GetText()
desc = song.desc.GetText()


showSearchList = [
{
ShortDescriptionLine1:title,
ShortDescriptionLine2:"Short Description for Show #2",
HDPosterUrl:image,
SDPosterUrl:image
}
]

Next

return showSearchList


End Function


Its also not bringing back all the results from the xml file, only one

I think its something to do with this:

showSearchList = [
{
ShortDescriptionLine1:title,
ShortDescriptionLine2:"Short Description for Show #2",
HDPosterUrl:image,
SDPosterUrl:image
}
]


But I have tried so many combos to change that and nothing will show up just sits there retrieving
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
TheEndless
Channel Surfer

Re: how to do that Vimeo style "next >>" link?

No, Return does not make it global, that returns it as a result of the function call, so you need to capture that returned value in a local variable. See how "categorySearchList" is done in that same function.

As for it only returning one result, you're only setting one result with that block of code. You should be initializing the array before the loop, then Push()ing each show into it. You had that right in the code you posted earlier (viewtopic.php?f=34&t=33396). Why'd you change it?
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
dynamitemedia
Binge Watcher

Re: how to do that Vimeo style "next >>" link?

"TheEndless" wrote:
No, Return does not make it global, that returns it as a result of the function call, so you need to capture that returned value in a local variable. See how "categorySearchList" is done in that same function.


yes i see it and no matter how many combinations i try to get it, it doesnt work! I just keep getting the same errors

i even tried

m.showSearchList =showSearchList
Next
return m.showSearchList


i took this example right from the simple Poster, so it should work! and if you look at that example and you uncomment this section:

m.curShow = displayShowDetailScreen(showList[msg.GetIndex()])


you get that same error

"TheEndless" wrote:

You should be initializing the array before the loop, then Push()ing each show into it. You had that right in the code you posted earlier (viewtopic.php?f=34&t=33396). Why'd you change it?


that was for the audio app, i am trying to do this with the video player example. i tried doing it the same was at that and it did not work, what should i change to get all the results because this is not using the poster screen for audio but rather video.

Thanks endless and thats why i get so frustrated i try to learn from the examples but trying to combine them or adapt cause so many issues at times, especially when you the example even tosses out errors
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
TheEndless
Channel Surfer

Re: how to do that Vimeo style "next >>" link?

This is the line I'm talking about:
categorySearchList = getCategorySearchList()

See how it's setting a local "categorySearchList" variable? You need to do the same thing:
showSearchList = getShowsForCategorySearchItem(categorySearchList[0])
screen.SetContentList(showSearchList)

This will initialize that variable and set it to the array returned from "getShowsForCategorySearchItem", so you can use it in your while loop.


Audio and Video work identically from a content item point of view, so the code should be very similar. Initialize showSearchList befor your For...Next loop:
showSearchList = []

Then push your "song"s into it within the loop:
showSearchList.Push(song)

The same as you did for your audio player example, you're just pushing into your own array instead of the contentItems array.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
dynamitemedia
Binge Watcher

Re: how to do that Vimeo style "next >>" link?

well i think i got that working endless but i made a few changes to get it working

one thing i cant seem to do is pass on any variables to this section though, to display the springboard
all the variables come back as invalid.


'if validateParam(m.showSearchList, "roAssociativeArray", "displayShowDetailSearchScreen") = false return -1

'shows = getShowsForCategorySearchItem(m.showSearchList, "0")
'screen = preShowDetailScreen("0", "0")
'showIndex = showDetailScreen(screen, shows, showIndex)


I tried hardcoding the "0"'s because those Values arent getting passed on and I am also not sure is this is correct

'if validateParam(m.showSearchList, "roAssociativeArray", "displayShowDetailSearchScreen") = false return -1
'shows = getShowsForCategorySearchItem(m.showSearchList, "0")


because the appPosterScreen.brs shows this as being

'if validateParam(category, "roAssociativeArray", "displayShowDetailSearchScreen") = false return -1
'shows = getShowsForCategorySearchItem(category, m.curCategory)


but i am not using "category" and when i tried changing the "m.showSearchList" to "category" in the code it just tosses out errors...

see what im trying to do is to pass this onto the appDetailsScreen.brs as i want to reuses that springboard and not the audioplayer style

Sub SearchResultsMain()

'initialize theme attributes like titles, logos and overhang color
initTheme()

'prepare the screen for display and get ready to begin
screen=preShowPosterSearchScreen("", "")
if screen=invalid then
print "unexpected error in preShowPosterSearchScreen"
return
end if

'set to go, time to get started
showPosterSearchScreen(screen)

End Sub

'******************************************************
Function preShowPosterSearchScreen(breadA=invalid, breadB=invalid) As Object

port=CreateObject("roMessagePort")
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(port)
if breadA<>invalid and breadB<>invalid then
screen.SetBreadcrumbText(breadA, breadB)
end if

screen.SetListStyle("flat-category")
return screen

End Function

'******************************************************
Function showPosterSearchScreen(screen As Object) As Integer

categorySearchList = getCategorySearchList()
screen.SetListNames(categorySearchList)
screen.SetContentList(getShowsForCategorySearchItem(categorySearchList[0]))

m.showSearchList = getShowsForCategorySearchItem(categorySearchList[0])
screen.SetContentList(m.showSearchList)

screen.Show()

while true
msg = wait(0, screen.GetMessagePort())
if type(msg) = "roPosterScreenEvent" then
if msg.isListFocused() then

m.curCategory = msg.GetIndex()

screen.SetFocusedListItem(m.curShow)
screen.SetContentList(getShowsForCategorySearchItem(m.showSearchList, m.curCategory))

else if msg.isListItemFocused() then
print"list item focused | current show = "; msg.GetIndex()


else if msg.isListItemSelected() then

m.curShow = msg.GetIndex()
m.curShow = displayShowDetailSearchScreen(m.showSearchList, m.curShow)
screen.SetFocusedListItem(m.curShow)

else if msg.isScreenClosed() then
return -1
end if
end If
end while


End Function

'**********************************************************
'** When a poster on the home screen is selected, we call
'** this function passing an roAssociativeArray with the
'** ContentMetaData for the selected show. This data should
'** be sufficient for the springboard to display
'**********************************************************
Function displayShowDetailSearchScreen(category as Object, showIndex as Integer) As Integer

[color=#FF0000]

'if validateParam(m.showSearchList, "roAssociativeArray", "displayShowDetailSearchScreen") = false return -1

'shows = getShowsForCategorySearchItem(m.showSearchList, "0")
'screen = preShowDetailScreen("0", "0")
'showIndex = showDetailScreen(screen, shows, showIndex)[/color]

'return showIndex

print "current show = "

return 1

End Function

'***************************************************************

Function getCategorySearchList() As Object

categorySearchList = CreateObject("roArray", 10, true)

categorySearchList = [ "Search Results" ]
return categorySearchList

End Function

'********************************************************************
Function getShowsForCategorySearchItem(category As Object) as Object

m.UrlBase = "http://xxxx.com/"
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 register response: ", xml.GetName())
ShowConnectionFailed()
return ""
end if

if islist(xml.GetBody()) = false then
Dbg("No registration information available")
ShowConnectionFailed()
return ""
end if

showSearchList = []

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.name.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)
showSearchList.Push(song)

Next

return showSearchList


End Function


This will then be used as a search for the video player example.... almost there Endless just see me through this! almost there
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
dynamitemedia
Binge Watcher

Re: how to do that Vimeo style "next >>" link?

Hate to bump this but I been messing with this and still no luck, been trying to change all the variables from showSearchList to Category and still no luck in fact just tosses more errors.
Twitter: iptvmyway facebook: iptvmyay
Channels: Warriors of War, Go Fight Live, Heading Outdoorz, IPTVmyway
0 Kudos
TheEndless
Channel Surfer

Re: how to do that Vimeo style "next >>" link?

I don't understand what you mean by "one thing i cant seem to do is pass on any variables to this section"... pass variables how and from where?

I'm afraid I'm not familiar enough with the videoplayer sample to know what that code is intended to do, nor how you're trying to use it. Have you tried my earlier suggestion of adding a lot of debug prints to the code, so you can better understand what happens during each step? I can tell you that just swapping variable names around isn't going to get you very far, and will most likely just further confuse the code.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.