search in category feed

I am using the video player example. so i am getting my categories from a xml feed off my website

what i want to do is add in the category feed that comes back a search as one of the categories.

I have been able to get the cosmetic look of it, but when you click on search it doesn’t bring up the Roku’s search

how have others done this? i remember reading you can add special categories, is that how some have done this?

I can add the search as a button on the welcome page and do a search but i want to add it in the category feed to get the feel like the youtube or eztakes feel to it.

Thanks

Search isn’t automatic. You have to implement it yourself. I posted this awhile back to make the UI part a bit easier: viewtopic.php?f=34&t=32518&p=202516#p202518
You’ll still have to write the actual search and results code.

Yes i know you have to implement it.

where do i put that code in the appPosterScreen? is there a section i should put it in? i found that taking snipplets of code can cause hours of grief if not put in the correct spot and so this time i am asking where it should go.

also that thread doesn’t help me understand how that is added in the category tree or how to add it to the categories? I want to do it like the youtube and have a search image and when you click on that it takes you to the search from inside Roku.

I am sorry i guess i need it dummified cause i am just not following

also when i say i got the cosmetic look what i did was added the search category leaf in my xml.

because i am using the video player example, it seems the only way i could add any “special” categories such a s search etc was via that feed.

could i place a showscreen() in that section of displaySpecialCategoryScreen ?

I’m pretty sure the YouTube channel doesn’t use RSS feeds, so the search option would be added programmatically there, too. The code I posted is a complete implementation that’s meant to be included as another file in your project. What you would do is add the “search = NewSearchWindow()” part to your IsListItemSelected event in your poster screen wait loop, within a check for the selected item being your Search item.

Endless first off as always thanks for your help.. with that said i am still very confused…

I am using the video player example, I cant change that. with that being said.

lets try and do one thing at a time because its confusing me more.

in the video player example, How would i pro grammatically add the search function in the poster screen with image and all

“dynamitemedia” wrote:
I am using the video player example, I cant change that. with that being said.
Why can’t you change that? You certainly should be able to modify it and add files to it… ? Or do you mean, it’s too late in the game to change the base code for your channel?

“dynamitemedia” wrote:
in the video player example, How would i pro grammatically add the search function in the poster screen with image and all
In getShowsForCategoryItem, you could add a new item to the end of the showList that “conn.LoadShowFeed()” returns…

showList = conn.LoadShowFeed(conn)
showList.Push( { ShortDescriptionLine1: "Search", HDPosterUrl: "pkg:/images/mysearchhd.png", SDPosterUrl: "pkg:/images/mysearchsd.png" })

And then, in showPosterScreen, add an “if” to the “msg.isListItemSelected()” section that checks if the selected item is your custom search item or one of the feed items. If it’s the search item, then you’d call your search code.

Endless did you test that? first i am trying to just add the search icon to the category list then will try to get the “if” statement your talking about.

this is the error i get

BrightScript Debugger> *** ERROR compiling /pkg:/source/appPosterScreen.brs:
line 174, error code &h02: Syntax Error
Function getShowsForCategoryItem(category As Object, item As Integer) As Object

    if validateParam(category, "roAssociativeArray", "getCategoryList") = false return invalid 

    conn = InitShowFeedConnection(category.kids[item])
    showList = conn.LoadShowFeed(conn)
 174 --  showList.Push( { ShortDescriptionLine1: "Search", HDPosterUrl:   showList.Push( { ShortDescriptionLine1: "Search", HDPosterUrl:    "pkg:/images/search.png", SDPosterUrl: "pkg:/images/search.png" })

    return showList
End Function

I have tried adding the whole code you sent at the end or before of this : return showList and i get errors too

so again im running into snipplets and where they belong :disappointed_face:

No, I didn’t test it. I typed it directly into the forum post, but it looks like you double-pasted after the HDPosterUrl…

Ok, I just tested it, and it works without a syntax error, so it’s definitely something you introduced in your copy/paste. That being said, this adds a search item to the appPosterScreen, not the appHomeScreen, which I think is what you actually want to do. If that’s the case, then you’d need to add it to the initCategoryList function in appHomeScreen.brs…

Function initCategoryList() As Void

    conn = InitCategoryFeedConnection()

    m.Categories = conn.LoadCategoryFeed(conn)
    m.Categories.Kids.Push({ Type: "search", ShortDescriptionLine1: "Search", HDPosterUrl: "pkg:/images/mysearchhd.png", SDPosterUrl: "pkg:/images/mysearchsd.png" })
    m.CategoryNames = conn.GetCategoryNames(m.Categories)

End Function

And then add a new condition to the showHomeScreen wait loop:

                if kid.type = "search" then
                    print "Search"
                else if kid.type = "special_category" then

I was posting something when i saw this last post, in fact i found that it was showing up at the end of the feeds and was posting how i tried moving it around and getting nowhere but yo answered as i was posting! Thanks

i got it working now with my search functions, i cant thank you enough and now i have some other ideas i can use this for.

I hope this helps other people as well, Endless so good to have you on these boards!

uh oh Endless…

after i added

if kid.type = "search" then
                    print "Search"

    searchWin = NewSearchWindow()
    searchTerm = searchWin.Show()
    If searchTerm <> invalid And searchTerm <> "Cancel" Then
        'Do search based on searchTerm
    End If
                else if kid.type = "special_category" then

the search comes up, but as soon as i hit search, it exits and goes back to the poster screen or if i click on one of the “Past Searches” terms, basically anytime i hit the select button

I added the code as you posted here http://forums.roku.com/viewtopic.php?f=34&t=32518&p=202516#p202518
and made it – search.brs

Now i need to search around for how this search can check results from my server.

That’s not an “uh oh”.. that’s how it’s supposed to work. searchWin.Show() sets the “searchTerm” variable to the value entered on the search screen. You would use that to perform your search… probably want to put up a “Please Wait…” dialog while performing the search and updating the content list. It may be easiest if you actually do the search on your server, and return an RSS feed of the results. That would require minimal code changes on the BrightScript side. Something like “http://my.server.com/rssfeed.php?search=searchTerm”.

probably want to put up a “Please Wait…” dialog while performing the search and updating the content list.

– yes thats a great idea, but i want the search results to stay right inside this “subcategory” under the main posterscreen. but as it is now it exits to the main posterscreen on any click

It may be easiest if you actually do the search on your server, and return an RSS feed of the results.

– yes thats the best idea for my project.

That would require minimal code changes on the BrightScript side. Something like “http://my.server.com/rssfeed.php?search=searchTerm”.

– again how can i keep this feed inside this category and show these results inside this “subcategory” ?

sorry for so many questions but after searching there isn’t a lot of info about the search - serverside in the SDK

Sounds to me like you need to spend some time deciphering just how the videoplayer app works… :wink:
I’ve never used it myself, but based on what I can tell by browsing through the code, I’d move the kid.type = “search” check into the getShowsForCategoryItem function of the appPosterScreen.brs file, and route it to my search RSS instead of the standard static RSS feed URLs.

I know your using a different method, but similar to your justinTv app…

i just went there to check it out, you have your search and then it leads to a “search results

Thats exactly what i am looking for

Sounds to me like you need to spend some time deciphering just how the videoplayer app works…

– love to say i did know but there are so many parts to it. and no real documentation on it

I’d move the kid.type = “search” check into the getShowsForCategoryItem function of the appPosterScreen.brs file,

– thats what i was trying to do earlier but it was ending up at the end of each feed

and route it to my search RSS instead of the standard static RSS feed URLs.

– not really sure what you mean here? My category feeds on the server side are not static if thats what your referring to. thats why i need to stick with the video player example as i need to constantly check for new videos being added from the DB.

I have said a million times on these forums and even messages to you, that this brightscript is not something i can understand well, the only place to get info is here and its not easy at times to get the help one needs.

reading the SDK for a novice is so Darn frustrating at times as it only serves to confuse me more.

so please try to understand and know i appreciate all your help and examples.

“dynamitemedia” wrote:
– not really sure what you mean here? My category feeds on the server side are not static if thats what your referring to. thats why i need to stick with the video player example as i need to constantly check for new videos being added from the DB.
“static” meaning the contents are always for that specific category, rather than returned based on a search query.

“dynamitemedia” wrote:
I have said a million times on these forums and even messages to you, that this brightscript is not something i can understand well, the only place to get info is here and its not easy at times to get the help one needs.

reading the SDK for a novice is so Darn frustrating at times as it only serves to confuse me more.

so please try to understand and know i appreciate all your help and examples.
I understand that, but I’m trying to steer you in the right direction without straight out giving you the answer… for two reasons really.. 1) so you actually start to understand how it works, which will make it a lot easier to make updates moving forward, and 2) because I don’t really have the time at the moment to pick apart the videoplayer example to make it work the way you want it to. This isn’t really a BrightScript thing, it’s a programming logic thing. If you can familiarize yourself with the primary function of each block of code, then it will become pretty obvious where you need to make changes to implement your desired functionality. If you have trouble with writing the BrightScript after that, then it’s easy for us to help with that.

That being said, the videoplayer example is pretty complex, so I’m not surprised that you’re having trouble figuring it out. If you really want to learn how to do this effectively, then I’d suggest starting with a simpler example and working your way up. Most of the SDK examples use a common style, so taking the time to understand one of the simpler ones (like simplevideoplayer) will go a long way to helping you to decipher the more complicated ones.

yes it is complex but its the only one that meets our needs.

it is much easier for myself and I am sure others to actually see something working to understand how it works.

I am not a programmer by trade and doing the best i can.

Thanks for option)

Darn i thought there was gonna be an update!! LOL