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…

I imagine it’s complaining about about “showSearchList” which isn’t defined anywhere else in that function…

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.

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

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?

“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

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.

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

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.

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.

This is the code that the appPosterScreen uses from the video player example to pass the video information from the Poster screen to the spring board

'**********************************************************
'** 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 displayShowDetailScreen(category as Object, showIndex as Integer) As Integer

    if validateParam(category, "roAssociativeArray", "displayShowDetailScreen") = false return -1

    shows = getShowsForCategoryItem(category, m.curCategory)
    screen = preShowDetailScreen(category.Title, category.kids[m.curCategory].Title)
    showIndex = showDetailScreen(screen, shows, showIndex)

    return showIndex
End Function

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

I need somehow for the values here :

else if msg.isListItemSelected() then

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

to populate this below:

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 m.showSearchList because “category” didnt seem to work

and i tried hardcoding the other parts with “0” because I couldnt get variables to replace these:

.Title

and once again my full code is here:

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

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

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

   '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://xxxxxx.com/roku"
    m.UrlGetSearchInfo  = m.UrlBase + "/xml/search.php"

    http = NewHttp(m.UrlGetSearchInfo)
    'http.AddParam("genre", "wrestling")

    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 actually is just a rework of the simplePoster.brs in the simple poster example. we have added the ability to use xml to populate the actual poster. and now i am trying to pass that info onto the springboard screen, which i want to use the springboard already in use if possible.

Does that help? I think if i can figure out how to get those variables into what i shown above i should be able to get that over to the already built spring Board

if you have a better idea on how to do this, please pass it on… i have spent days on this and is killing me…

I think it’s going to be a lot easier, if you just leave everything else the way it is, and just modify what “getShowsForCategoryItem” returns. As long as it returns your search items in the same format as it’s expecting, it should just work. Don’t get caught up in renaming category to search and vice versa, because I think that’s what’s mainly tripping you up. So, I would recommend starting afresh with the SimplePoster.brs, and just change the “getShowsForCategoryItem” function.

endless i almost got this but this “category” is using a “roAssociativeArray”

I tried printing all sorts of ways to get the category’s info so i can hard code it in my show feed

category kids <ROT:roAssociativeArray>
<ROT:roAssociativeArray>
<ROT:roAssociativeArray>
<ROT:roAssociativeArray>
<ROT:roAssociativeArray>

and no matter what i do as far as printing goes i cant figure out all that makes this variable so i can recreate it and hard code it here:

conn = InitShowFeedConnection(category.kids[item])

if xml looks like this:


<categories>

<category title="world war two" description="" sd_img="http://xxxxxx.com/roku/images/wwII.jpg" hd_img="http://xxxxxx.com/roku/images/wwII.jpg">

		<categoryLeaf title="search" description="" feed="http://xxxxxx.com/roku/feeds/search.php"/>
	</category>

and i need to get to the “feed” what could i use to replace this “)”

i tried using InitShowFeedConnection(movies) but that didnt work either

“dynamitemedia” wrote:
endless i almost got this but this “category” is using a “roAssociativeArray”

I tried printing all sorts of ways to get the category’s info so i can hard code it in my show feed

category kids 

There is a PrintAA() utility function in the example code that I find very useful. It takes a roAssociativeArray as an argument and prints its contents to the console.

Thanks Chris,

But I added that all i get is a error saying

Wrong number of function parameters.

167:     PrintAA()

i am guessing there is more than just typing that in now… and if so, what is the complete and correct way of doing it?

you said example code, which example though?

You missed where Chris said, “It takes a roAssociativeArray as an argument”. So you need PrintAA(category).

-JT

thanks RenoJim…

the problem is that this can still be confusing and i take what is given to me literally at times, I am still not getting this to work even after ready that array

I am just trying to reproduce it so i can do a search in the video player example, i can get it right to the point of showing the feed but not able to view it once clicked. basically i cant click the the video in the poster and send it to the springboard that the video player already uses.

I think my only chance is to bloat the code more and just create another AppDetailscreen. i was trying to avoid that by changing some code around and using existing code, but i have found that these examples do not play well with each other!at least with what i can do with brightscript.

thanks for all your help guys